text:
Marshmallow not bootlooping, but not starting
What Happened:
A few days back I left my phone (MediaTek chipset) to charge overnight. What I did not notice was that the charger was loose and the charge was at around 2%. The next morning, I woke up to find my phone's battery drained completely.
When I tried to start it (after charging), it was taking a bit too much time, and the phone was heating up. However, the boot didn't complete nor did the phone reboot (like a bootloop).
What I Did:
I went to the recovery, took backups, cleared the /data partition, and got the phone to start. However, I require the application data (more than the phone) and just formatting the partition didn't seem to take me closer to my goal and hence I restored the backups.
I then cleared the data of several programs which might have caused the problem:
rm -rf com.android.captiveportallogin com.android.carrierconfig com.android.cellbroadcastreceiver com.android.certinstaller com.android.defcontainer com.android.development com.android.documentsui com.android.externalstorage com.android.frameworks.telresources com.android.keychain com.android.managedprovisioning com.android.mms.service com.android.noisefield com.android.pacprocessor com.android.printspooler com.android.proxyhandler com.android.server.telecom com.android.statementservice com.android.stk com.android.vpndialogs com.android.webview com.gametion.ludo com.google.android.configupdater com.grarak.kerneladiutor com.jrummy.app.managerfree com.lexa.fakegps com.makeinfo.androididchanger com.one24.deviceid com.ores.hash com.phoneinfo.changer com.resurrection.otacom.sanctuaire.netswisstool com.unique.mobilefaker com.zimperium.zanti cyanogenmod.platform de.robv.android.xposed.installer it.evilsocket.dsploit net.fidanov.landroid org.cyanogenmod.livelockscreen.service org.cyanogenmod.providers.datausage
rm -rf org.cyanogenmod.snap org.cyanogenmod.theme.chooser org.cyanogenmod.themes.provider org.cyanogenmod.wallpapers.photophase org.cyanogenmod.weather.provider org.omnirom.omniswitch tursky.jan.settings
rm -rf com.android.settings com.android.systemui

Didn't help...
So I accessed logcat and extracted some of the possibly juicy bits (in random order):
page record for 0xb6e4301c was not found
AndroidRuntime:        at com.android.server.pm.PackageManagerService.main(PackageManagerService.java:1873)
ServiceManager: service 'batterystats' died
01-01 07:33:29.583  8300  8300 D AndroidRuntime: Shutting down VM
01-01 07:33:29.584  8300  8300 E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main
01-01 07:37:16.064 15437 15437 E AndroidRuntime: Error reporting crash
01-01 07:37:16.064 15437 15437 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'void android.app.IActivityManager.handleApplicationCrash(android.os.IBinder, android.app.ApplicationErrorReport$CrashInfo)' on a null object reference
01-01 07:37:16.064 15437 15437 I Process : Sending signal. PID: 15437 SIG: 9
01-01 07:37:16.088   189   189 I ServiceManager: service 'batterystats' died
01-01 07:37:16.088   189   189 I ServiceManager: service 'appops' died
01-01 07:37:16.088   189   189 I ServiceManager: service 'power' died
01-01 07:37:16.088   189   189 I ServiceManager: service 'display' died
01-01 07:37:16.093   217   217 E installd: eof
01-01 07:37:16.093   217   217 E installd: failed to read size
01-01 07:37:16.093   217   217 I installd: closing connection
01-01 07:37:16.404 12127 12127 I Zygote  : Process 12239 exited cleanly (13)
01-01 07:37:16.405 12127 12127 E Zygote  : Exit zygote because system server (15437) has terminated
01-01 07:37:16.446   189   189 I ServiceManager: service 'user.xposed.app' died
01-01 07:37:16.453   189   189 I ServiceManager: service 'media.audio_flinger' died
01-01 07:37:16.453   189   189 I ServiceManager: service 'media.player' died
01-01 07:37:16.453   189   189 I ServiceManager: service 'media.resource_manager' died
01-01 07:37:35.780 17500 17500 E cutils-trace: Error opening trace file: No such file or directory (2)
01-01 07:32:20.048  3896  3896 E AndroidRuntime: Error reporting WTF
01-01 07:32:20.048  3896  3896 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.app.IActivityManager.handleApplicationWtf(android.os.IBinder, java.lang.String, boolean, android.app.ApplicationErrorReport$CrashInfo)' on a null object reference
01-01 07:32:20.048  3896  3896 E AndroidRuntime:        at com.android.internal.os.RuntimeInit.wtf(RuntimeInit.java:353)
01-01 07:32:20.048  3896  3896 E AndroidRuntime:        at android.util.Log$1.onTerribleFailure(Log.java:104)
01-01 07:32:20.048  3896  3896 E AndroidRuntime:        at android.util.Log.wtf(Log.java:297)
01-01 07:32:20.048  3896  3896 E AndroidRuntime:        at android.util.Slog.wtf(Slog.java:82)
01-01 07:32:41.126  5786  5786 E AndroidRuntime: android.util.Log$TerribleFailure: No start tag found in package manager settings
01-01 07:32:41.161  5786  5786 W PackageManager: Library not found: /system/framework/org.apache.http.legacy.jar
01-01 07:32:41.247  5786  5786 E System  : ******************************************
01-01 07:32:41.249  5786  5786 E System  : ************ Failure starting system services
01-01 07:32:41.249  5786  5786 E System  : java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.android.server.pm.Settings$VersionInfo.fingerprint' on a null object reference

Then I got an idea and did rm -rf /data/data and mkdir /data/data. Didn't help but showed that the problem was not due to app data but something else in the data partition.
Soon, I noticed a repeating pattern in logcat, indicating my phone was stuck in a loop (not bootloop) and not a blocking call to a process or thread.
The looping logcat:
01-01 07:32:53.191  6368  6368 E System  : ******************************************
01-01 07:32:53.191  6368  6368 E System  : ************ Failure starting system services
01-01 07:32:53.191  6368  6368 E System  : java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.android.server.pm.Settings$VersionInfo.fingerprint' on a null object reference
01-01 07:32:53.191  6368  6368 E System  :      at com.android.server.pm.PackageManagerService.<init>(PackageManagerService.java:2170)
01-01 07:32:53.191  6368  6368 E System  :      at com.android.server.pm.PackageManagerService.main(PackageManagerService.java:1873)
01-01 07:32:53.191  6368  6368 E System  :      at com.android.server.SystemServer.startBootstrapServices(SystemServer.java:387)
01-01 07:32:53.191  6368  6368 E System  :      at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
01-01 07:32:53.191  6368  6368 E System  :      at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:334)
01-01 07:32:53.191  6368  6368 E System  :      at com.android.server.SystemServer.startBootstrapServices(<Xposed>)
01-01 07:32:53.191  6368  6368 E System  :      at com.android.server.SystemServer.run(SystemServer.java:289)
01-01 07:32:53.191  6368  6368 E System  :      at com.android.server.SystemServer.main(SystemServer.java:176)
01-01 07:32:53.191  6368  6368 E System  :      at java.lang.reflect.Method.invoke(Native Method)
01-01 07:32:53.191  6368  6368 E System  :      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
01-01 07:32:53.191  6368  6368 E System  :      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
01-01 07:32:53.191  6368  6368 E System  :      at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
01-01 07:32:53.192  6368  6368 E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main
01-01 07:32:53.192  6368  6368 E AndroidRuntime: java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.android.server.pm.Settings$VersionInfo.fingerprint' on a null object reference
01-01 07:32:53.192  6368  6368 E AndroidRuntime:        at com.android.server.pm.PackageManagerService.<init>(PackageManagerService.java:2170)
01-01 07:32:53.192  6368  6368 E AndroidRuntime:        at com.android.server.pm.PackageManagerService.main(PackageManagerService.java:1873)
01-01 07:32:53.192  6368  6368 E AndroidRuntime:        at com.android.server.SystemServer.startBootstrapServices(SystemServer.java:387)
01-01 07:32:53.192  6368  6368 E AndroidRuntime:        at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
01-01 07:32:53.192  6368  6368 E AndroidRuntime:        at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:334)
01-01 07:32:53.192  6368  6368 E AndroidRuntime:        at com.android.server.SystemServer.startBootstrapServices(<Xposed>)
01-01 07:32:53.192  6368  6368 E AndroidRuntime:        at com.android.server.SystemServer.run(SystemServer.java:289)
01-01 07:32:53.192  6368  6368 E AndroidRuntime:        at com.android.server.SystemServer.main(SystemServer.java:176)
01-01 07:32:53.192  6368  6368 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
01-01 07:32:53.192  6368  6368 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
01-01 07:32:53.192  6368  6368 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
01-01 07:32:53.192  6368  6368 E AndroidRuntime:        at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
01-01 07:32:53.193  6368  6368 E AndroidRuntime: Error reporting crash
01-01 07:32:53.193  6368  6368 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'void android.app.IActivityManager.handleApplicationCrash(android.os.IBinder, android.app.ApplicationErrorReport$CrashInfo)' on a null object reference
01-01 07:32:53.193  6368  6368 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:95)
01-01 07:32:53.193  6368  6368 E AndroidRuntime:        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
01-01 07:32:53.193  6368  6368 E AndroidRuntime:        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
01-01 07:32:53.411  6438  6438 F libc    : page record for 0xb6d8301c was not found (block_size=16)
01-01 07:32:57.925  6682  6682 F libc    : page record for 0xb6e5b01c was not found (block_size=16)
01-01 07:33:03.304  6930  6930 F libc    : page record for 0xb6de901c was not found (block_size=16)
01-01 07:33:05.758  7050  7050 I InstallerConnection: connecting...
01-01 07:33:05.772  7050  7050 I InstallerConnection: disconnecting...
01-01 07:33:05.790  7050  7050 I SystemServer: Entered the Android system server!
01-01 07:33:05.896  7050  7050 I SystemServiceManager: Starting com.android.server.pm.Installer
01-01 07:33:05.897  7050  7050 I Installer: Waiting for installd to be ready.
01-01 07:33:05.897  7050  7050 I InstallerConnection: connecting...
01-01 07:33:05.897  7050  7050 I SystemServiceManager: Starting com.android.server.am.ActivityManagerService$Lifecycle
01-01 07:33:05.908  7050  7050 I XXXXXX  : choosing minFree values for 32 Bit
01-01 07:33:05.908  7050  7050 I XXXXXX  : choosing minFree values for 32 Bit
01-01 07:33:05.908  7050  7050 I XXXXXX  : choosing minFree values for 32 Bit
01-01 07:33:05.908  7050  7050 I XXXXXX  : choosing minFree values for 32 Bit
01-01 07:33:05.908  7050  7050 I XXXXXX  : choosing minFree values for 32 Bit
01-01 07:33:05.908  7050  7050 I XXXXXX  : choosing minFree values for 32 Bit
01-01 07:33:06.027  7050  7050 I ActivityManager: Memory class: 96
01-01 07:33:06.101  7050  7050 D BatteryStatsImpl: Reading daily items from /data/system/batterystats-daily.xml
01-01 07:33:06.254  7050  7050 W ProcessCpuTracker: Skipping unknown process pid 7075
01-01 07:33:06.265  7050  7050 I IntentFirewall: Read new rules (A:0 B:0 S:0)
01-01 07:33:06.279  7050  7050 D AppOps  : AppOpsService published
01-01 07:33:06.279  7050  7050 I SystemServiceManager: Starting com.android.server.power.PowerManagerService
01-01 07:33:06.287  7050  7050 I SystemServiceManager: Starting com.android.server.lights.LightsService
01-01 07:33:06.290  7050  7050 I SystemServiceManager: Starting com.android.server.display.DisplayManagerService
01-01 07:33:06.293  7050  7050 I SystemServiceManager: Starting phase 100
01-01 07:33:06.301  7050  7094 I DisplayManagerService: Display device added: DisplayDeviceInfo{"Built-in Screen": uniqueId="local:0", 720 x 1280, modeId 1, defaultModeId 1, supportedModes [{id=1, width=720, height=1280, fps=55.9}], colorTransformId 1, defaultColorTransformId 1, supportedColorTransforms [{id=1, colorTransform=0}], density 320, 294.967 x 295.563 dpi, appVsyncOff 0, presDeadline 18889087, touch INTERNAL, rotation 0, type BUILT_IN, state UNKNOWN, FLAG_DEFAULT_DISPLAY, FLAG_ROTATES_WITH_CONTENT, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}
01-01 07:33:06.304  7050  7050 I SystemServer: Package Manager
01-01 07:33:06.309  7050  7094 I DisplayManagerService: Display device changed state: "Built-in Screen", ON
01-01 07:33:08.137  7201  7201 F libc    : page record for 0xb6e5701c was not found (block_size=16)
01-01 07:33:13.103  7467  7467 F libc    : page record for 0xb6de801c was not found (block_size=16)
01-01 07:33:17.544  7700  7700 I InstallerConnection: connecting...
01-01 07:33:17.552  7700  7700 I InstallerConnection: disconnecting...
01-01 07:33:17.579  7700  7700 I SystemServer: Entered the Android system server!
01-01 07:33:17.750  7700  7700 I SystemServiceManager: Starting com.android.server.pm.Installer
01-01 07:33:17.750  7700  7700 I Installer: Waiting for installd to be ready.
01-01 07:33:17.750  7700  7700 I InstallerConnection: connecting...
01-01 07:33:17.751  7700  7700 I SystemServiceManager: Starting com.android.server.am.ActivityManagerService$Lifecycle
01-01 07:33:17.760  7700  7700 I XXXXXX  : choosing minFree values for 32 Bit
01-01 07:33:17.760  7700  7700 I XXXXXX  : choosing minFree values for 32 Bit
01-01 07:33:17.760  7700  7700 I XXXXXX  : choosing minFree values for 32 Bit
01-01 07:33:17.760  7700  7700 I XXXXXX  : choosing minFree values for 32 Bit
01-01 07:33:17.760  7700  7700 I XXXXXX  : choosing minFree values for 32 Bit
01-01 07:33:17.760  7700  7700 I XXXXXX  : choosing minFree values for 32 Bit
01-01 07:33:17.836  7700  7700 I ActivityManager: Memory class: 96
01-01 07:33:17.914  7700  7700 D BatteryStatsImpl: Reading daily items from /data/system/batterystats-daily.xml
01-01 07:33:18.187  7700  7700 W ProcessCpuTracker: Skipping unknown process pid 7732
01-01 07:33:18.196  7700  7700 I IntentFirewall: Read new rules (A:0 B:0 S:0)
01-01 07:33:18.333  7700  7700 D AppOps  : AppOpsService published
01-01 07:33:18.334  7700  7700 I SystemServiceManager: Starting com.android.server.power.PowerManagerService
01-01 07:33:18.353  7700  7700 I SystemServiceManager: Starting com.android.server.lights.LightsService
01-01 07:33:18.356  7700  7700 I SystemServiceManager: Starting com.android.server.display.DisplayManagerService
01-01 07:33:18.370  7700  7761 I DisplayManagerService: Display device added: DisplayDeviceInfo{"Built-in Screen": uniqueId="local:0", 720 x 1280, modeId 1, defaultModeId 1, supportedModes [{id=1, width=720, height=1280, fps=55.9}], colorTransformId 1, defaultColorTransformId 1, supportedColorTransforms [{id=1, colorTransform=0}], density 320, 294.967 x 295.563 dpi, appVsyncOff 0, presDeadline 18889087, touch INTERNAL, rotation 0, type BUILT_IN, state UNKNOWN, FLAG_DEFAULT_DISPLAY, FLAG_ROTATES_WITH_CONTENT, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}
01-01 07:33:18.373  7700  7700 I SystemServiceManager: Starting phase 100
01-01 07:33:18.374  7700  7761 I DisplayManagerService: Display device changed state: "Built-in Screen", ON
01-01 07:33:18.375  7700  7700 I SystemServer: Package Manager
01-01 07:33:18.496  7700  7700 D SELinuxMMAC: Using policy file /system/etc/security/mac_permissions.xml
01-01 07:33:18.504  7700  7700 W PackageManager: No start tag found in package manager settings
01-01 07:33:18.507  7700  7700 E PackageManager: No start tag found in package manager settings
01-01 07:33:18.509  7700  7700 E AndroidRuntime: Error reporting WTF
01-01 07:33:18.509  7700  7700 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.app.IActivityManager.handleApplicationWtf(android.os.IBinder, java.lang.String, boolean, android.app.ApplicationErrorReport$CrashInfo)' on a null object reference
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.internal.os.RuntimeInit.wtf(RuntimeInit.java:353)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at android.util.Log$1.onTerribleFailure(Log.java:104)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at android.util.Log.wtf(Log.java:297)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at android.util.Slog.wtf(Slog.java:82)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.server.pm.Settings.readLPw(Settings.java:2829)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.server.pm.PackageManagerService.<init>(PackageManagerService.java:2030)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.server.pm.PackageManagerService.main(PackageManagerService.java:1873)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.server.SystemServer.startBootstrapServices(SystemServer.java:387)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:334)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.server.SystemServer.startBootstrapServices(<Xposed>)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.server.SystemServer.run(SystemServer.java:289)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.server.SystemServer.main(SystemServer.java:176)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
01-01 07:33:18.509  7700  7700 E AndroidRuntime: Original WTF:
01-01 07:33:18.509  7700  7700 E AndroidRuntime: android.util.Log$TerribleFailure: No start tag found in package manager settings
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at android.util.Log.wtf(Log.java:291)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at android.util.Slog.wtf(Slog.java:82)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.server.pm.Settings.readLPw(Settings.java:2829)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.server.pm.PackageManagerService.<init>(PackageManagerService.java:2030)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.server.pm.PackageManagerService.main(PackageManagerService.java:1873)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.server.SystemServer.startBootstrapServices(SystemServer.java:387)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:334)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.server.SystemServer.startBootstrapServices(<Xposed>)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.server.SystemServer.run(SystemServer.java:289)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.server.SystemServer.main(SystemServer.java:176)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
01-01 07:33:18.509  7700  7700 E AndroidRuntime:        at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
01-01 07:33:18.527  7700  7700 W PackageManager: Library not found: /system/framework/org.apache.http.legacy.jar
01-01 07:33:18.580  7700  7700 E System  : ******************************************
01-01 07:33:18.581  7700  7700 E System  : ************ Failure starting system services

Note that the first and last 2 lines are the same, indicating a loop.
/data/system # rm -rf * helps start the phone, so the problem is there. But running the command results in a partial loss of the application data (so I restored the backups of the faulty /data partition).

Both referenced Xposed - try disabling it temporarily by mashing the volume buttons when first booting up. Also, try just flashing your original ROM again on top of the existing installation - sounds stupid but actually worked for me in a similar situation.

Done, not helping...

And I'll try the ROM thing tonight.

I just came across this problem myself on my Nexus 5 running Android 6 and after tinkering with it for a few days, I was able to resolve it without wiping all my data, so I wanted to share what I did in case anyone else ever comes across a similar issue and is up for the challenge of debugging the issue instead of wiping the phone.
My problems all seemed to have the same root cause: empty XML files. I had played around with disabling fsync in my kernel to try out the performance difference, and this probably caused some data loss.
Observation: /data/system/packages.xml, /data/system/packages.list, and /data/system/job/jobs.xml were empty.
Below are the steps I executed. Be aware, this is the result of experimentation and you shouldn't blindly execute these commands without understanding them first. ;)

Back up the entire /data partition.
Delete the /data/system directory and reboot to regenerate it.
Copy the /data/system directory somewhere (in my case: /sdcard/system-good).
Restore the backup of the /data partition, restoring erased app data.
Delete the JobStore file: rm /data/system/job/jobs.xml
Copy the regenerated files:
cat /sdcard/system-good/packages.list > /data/system/packages.list
cat /sdcard/system-good/packages.xml > /data/system/packages.xml

Fix package UID's based on the error logs:
grep "has changed from uid" /sdcard/system-good/uiderrors.txt | while read -r LINE; do sed -i "s/\(^$(echo "$LINE" | awk '{ printf "%s\\) %d/\\1 %d", $6, $13, $11 }')/" /data/system/packages.list ; done
grep "has changed from uid" /sdcard/system-good/uiderrors.txt | while read -r LINE; do sed -i "s/\(^    <package name=\"$(echo "$LINE" | awk '{ printf "%s\" .\\+ userId=\"\\)%d\">/\\1%d\">", $6, $13, $11 }')/" /data/system/packages.xml ; done

Wiped cache and dalvik for good measure.
Rebooted and my Android including all my apps were revived!

For me, this turned into a bit of a side project, and I learned a bit more about Android internals. :) Not all my steps may be relevant to resolve your scenario.
The empty jobs.xml caused a NullPointerException in the JobStore: java.lang.RuntimeException: Failed to create service com.android.server.job.JobSchedulerService: service constructor threw an exception.
It has already been fixed upstream, but that fix is not yet included in Android 6. Just deleting /data/system/job/jobs.xml skips the entire code section with the bug, resolving the issue.
The empty package manager files should regenerate upon deletion, however that unfortunately resulted in another bootloop for me, for which I was unable to collect logs to further assess the problem. So I recovered the system by deleting the entire /data/system, then made a copy of it and restored my backup of /data, and then diff'ed the old and the new version of /data/system to figure out what could be causing the crash.
In my case, the major difference was that the UID's for all my apps had changed in the regenerated package.xml and package.list files, causing the package manager to delete all data for those apps upon checking package contents during boot. I resolved this by copying the regenerated versions and changing them to match the old UID's, using the logfile which recorded all mismatched UID's. Not pretty, and in hindsight it might have been better to just read the UID's from the /data/data directories or look into how Android does this regeneration in the first place and tweak that, but this worked as well.

Thanks for posting your solution., Unclean shutdowns will cause the /data/system/packges files to reset to empty files,   If android would have keep backup or journal for those files it would be great.

Unfortunately this does not work anymore, as android deletes the apps instead of logging the uid-diffs to uiderrors.txt

As a complement to DvdGiessen's answer, you can perform a backup of the three files (jobs.xml, packages.xml and packages.list) with the following shell script:
#!/system/bin/sh
dir=/data/system

watch -n60 "cat $dir/packages.list > $dir/packages.list.bak" > /dev/null &
watch -n60 "cat $dir/packages.xml > $dir/packages.xml.bak" > /dev/null &
watch -n60 "cat $dir/job/jobs.xml > $dir/jobs.xml.bak" > /dev/null &

echo "Now periodically performing backup of packages' (APKs') databases..."

watch will, periodically, for each 60 seconds, make a backup of the three files. Save the shell script to /system/xbin directory, apply chmod 0755 and chown root.shell to it and manually run it.
Do note, however, it is not recommended to add the shell script to init.d, since that could write a broken backup of the three files.
Make a note of the permissions, owner, and group of the original files to, later, apply to the restored backups.
ls -l data/system/job/jobs.*
-rw------- 1 system system 1401 2021-04-06 11:42 data/system/job/jobs.xml

ls -l data/system/packages.*
-rw-r----- 1 system package_info  10289 2021-04-06 11:42 data/system/packages.list
-rw-rw---- 1 system system       477016 2021-04-06 11:42 data/system/packages.xml


text:
Does Titanium Backup backup the Signal private Key?
I am looking for a way to backup my private key for the Signal messenger application. Nothing has worked so far, and I am curious whether anyone can confirm or deny that Titanium backup will save and restore the private key of a Signal install.

I don't know about the Signal app and the private key you speak of but maybe that is stored in hardware. If your device supports that.

@miva2: Unlikely, since otherwise I would probably not have lost the private key twice after a reinstall. Secondly, I'd consider this a very insecure method of storing the private key, I don't think Signal would do that.

Signal 4.17.0 introduced encrypted backups. This is the preferred migration path. Also the Titanium Backup route does not work in current releases.

Previous Post
I just tried this and it worked flawlessly.
After restoring Signal on your new Phone you should re-activated your connection by unregistering and re-registering to the Signal servers. As of now you can do this in the Signal Settings > Advanced tab by toggleing Signal messages to de-activate then re-activate [1]. In this Process you will have to re-verify your phone number and you'll have to reconnect your Signal-Desktop clients afterwards.
You won't loose your Private key or your Signal-Desktop messages though.
[1] https://support.whispersystems.org/hc/en-us/articles/213190487-Why-is-there-a-delay-in-receiving-messages-

Just tried this, with Signal 3.30.4 and upgrading my phone from Android 5.0 to 7.1 - still works perfectly. I initially didn't un-register/re-register - but push notifications weren't working properly, so then I did. As @m-schulz-narres says I needed to re-connect the Signal Desktop clients I had but they did not lose their previous messages.
One thing to note is that group messages may get messed up by re-registering - you'll need a friend in the group to first accept your new safety number (you can directly message them), and then update the group (i.e. change the name or picture).

Even though I do trust the author of this answer without reservation, I can now confirm as well that this works indeed. Upgraded from Lollipop to Nougat, installed Signal and restored the data backup, and everything works.

Titanium Backup does backup the key, but there's something internal to Signal that realises that it's installed on a new phone and refuses to use the old key.
Set recurring backups inside Signal instead.
Be aware that when restoring:
Place the .backup file in the sdcard root directory. Putting it under sdcard/Signal/backups will have the file NOT be read, but no error message given, either.
The backup is only read correctly if the metadata is displayed in a confirmation step.  This took me hours to work out. >:|

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Where is Android boot animation saved?
When you start an Android device, there is an animation showed, usually "Android", but sometimes the manufacturer's logo.
Where is this animation stored? I have looked in the boot.img, but can't see it there.

A root is required to perform this task.
Use any file explorer application such as ES File Explorer, with root access.
Go to the root directory of internal / system / media. You can see a file named bootanimation.zip, which is the one that loaded during boot.

Extracting the zip may display multiple folders named as part0, part1, part2,.. and desc.txt.

You don't need a rooted device to reach it

If you have a computer with Android Debug Bridge (ADB) available, you can run this command to find its location:
$ adb shell
# find . -iname "bootanimation.zip" 2>/dev/null
On one of my devices it was stored in /oem/media/bootanimation.zip and on the other device it was stored in /product/media/bootanimation.zip

The boot animation is located at
/(Home directory) > System > Media > ... (for me it's bootanimation.zip)

And of course you need a file explorer and a rooted phone I guess.

You don't need a rooted device to reach it

It appears you can override the boot animation on a device. Create a boot animation file, as described in the other answers, and copy it to /data/local, which is writable by adb without rooting:
adb push bootanimation.zip /data/local

Source: Emteria article on boot animations. I have not tried this yet.

For me, on Pixel 6 with Android 13, it's actually on:
/system/product/media/bootanimation-dark.zip

/system/product/media/bootanimation.zip

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Disable Google Voice Typing automatic language detection
I have been a fan of Google Voice Typing for a long time.
I use it for 2 languages, English and Italian.
On the Android Keyboard, I can switch the language of the spell-checker by pressing the "World" icon. Until a few months ago, that would also change the language of Google Voice Typing, i.e. when I pressed the microphone icon and started speaking, Google Voice Typing would interpret my words in the language I had selected on the keyboard.
Right now instead, Google Voice Typing got "smarter" and doesn't care about my keyboard setting, it just automatically detects the language I'm speaking. Of course, it gets it wrong most of the time, and that is very frustrating, in particular because when I speak Italian (my mother tongue), it often thinks I am speaking English instead.
So, does anybody know if I can disable this automatic language detection and revert to the old behavior?
Or do you have any suggestions on a workaround?

have you found a solution? That problem drives me nuts too. My temporary fix is to switch between my usual keyboard (Gboard or Swiftkeys) and Speechkeys, which is not great but does let you select the input language for Google Voice Typing. It's not an ideal keyboard as when you switch it shows you a long list of languages instead of favorites, so I'm looking for alternatives. Would love to hear any updates on your part!

Not really, the only workaround is to speak very slowly and split the words very clearly...

Ha, so you still have the issue. For switching languages, SpeechKeys works but is really ugly and gives you a list with all the languages of the world every time you switch, instead of your installed ones... It would be great to have the feature within the Gboard or SwiftKey keyboards. One way to get their attention is to post reviews in the Play Store. Also just posted a feature request on the SwiftKey forum, in case anyone can be bothered to comment and vote.

Unfortunately at the moment it is impossible to disable automatic language detection and force the speech to text to interpret spoken words with the language set manually in the keyboard.

This is a two-step process:

Settings > Language & input > Google Keyboard > Languages. Here disable English (disable Use System language if enabled) & only enable Italian.
Also in your Google Voice Typing option, set your Default Primary language as Italian.

Now Voice Typing will not pick up English words even if you wanted it to.

I want to be able to do Voice Typing both in Italian and English, I just want to choose manually instead of automatically ( which is usually wrong)

Sure definitely. Choose your language as mentioned in the post.

Go to Settings app of your phone and choose Google Voice typing option. Inside this you have an option to choose your Default Primary Language, as shown in below screen shot:

You can chose your Default (Italian) by Press + Hold the language name. Click SAVE and Google voice typing should pick your Updated default Primary Language irrespective of your Keyboard Settings.

Thanks! I already have this setup as you explain. Unfortunately it still detects language automatically.


text:
Rooted Incredible WiFi Tethering Not Working
I've rooted my Droid Incredible and installed both the "Wireless Tether" and "Barnacle Wifi Tether" apps but I can't seem to get internet connectivity on any other devices. I can see the connection on my laptop and on my iPad and my devices get ip addresses assigned to them but I can't connect to the internet. Google Chrome reports "Name unresolved" while Safari on the iPad only states that the device isn't connected to the internet. Why isn't this working?

Are "Wireless Tether" and "Barnacle Wifi Tether" designed for the Incredible?

@Matthew Read They weren't specifically designed for it, as far as I know. Wireless Tether was given as an answer to this question http://android.stackexchange.com/questions/1/ive-rooted-my-phone-now-what/13#13 so I'm assuming (bad practice, I know) that it should be working.

Did you download Wireless Tether from the Market or from http://code.google.com/p/android-wifi-tether/ ?
If you are running Android 2.1 you need to take the extra steps listed here:
http://code.google.com/p/android-wifi-tether/wiki/Setup_HTC_Desire_Incredible
If you are running 2.2 then in theory it should just work.
I would first try the latest release candidate here:
http://code.google.com/p/android-wifi-tether/downloads/detail?name=wireless_tether_2_0_5-RC2.apk&can=2&q=
Let me know how it works out.

Latest release candidate did it. Thank you so much!

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/2.5/


text:
Add NFC functionality (like Nexus S) via SDIO standard in microsd to non-NFC phones?
Google Nexus S is the first Android phone to include NFC (Near-field communication) for wireless hardware for applications such as contactless payment and perhaps proximity based target advertising.
I wonder if the micro SD card slot on other Android phones supports the SD IO standard. The SD card interface also defines an interface for devices as well as storage cards, for example a SD sized WiFi transmitter could be fitted to photo cameras for transmitting pictures to the internet as they were taken.
I wonder if the micro SD card slot also has this capability and if the NFC chip and antenna could be viable in such a form factor (and for some phones underneath the battery, but still user removable)?

The first part of your question is tautological: If the phone supports SDIO then yes, it supports SDIO.  The G1 and the "BeagleBoard" support it, I believe.  As for the NFC chip, I'd say that if it isn't small enough already then it could be shrunk to fit.  It's not a particularly complicated piece of electronics.
I'd see very little benefit in developing something like this, however.  I don't think NFC will take off before the next 2 or 3 generations of phones (if it does at all), so most people will be getting new ones instead of tricking out their old ones.

Edit: A bit early to accept an answer yet. The first paragraph is useful - particularly that the NFC could be small enough to fit in a microsd form factor.

+1 for your answer @Matthew Read, because your second paragraph raises a good point about taking off, this article: http://www.theregister.co.uk/2010/12/23/oyster_london_nfc/ indicates that NFC is an immature market in some time sensitive applications, i.e. rushing through a London tube gate, so @bulamonto's answer with a microsd is favourable, as this can be replaced as improved faster NFC arrives.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/2.5/


text:
Send all calls to Voice Mail
It's seems like it should be a simple thing, but I haven't figured it out yet on my desire.
How do I send all calls to voice mail?  I can disable the mobile data network and put the phone in airplane mode, but how do I keep the data active and send all calls to voice mail?

related: How to set a profile that only allows selected calls through?

If you don't have the option Matthew Read suggested, you could use a call blocking app.  Most of them have an option to block all calls.

I don't know why I didn't think to simple search for an app.  I guess I was stuck on what I thought should be an easy option somewhere obvious.

I went through the same thought process a couple months ago.  It just doesn't make sense that they wouldn't have a built in setting for this.

Settings -> Call -> Call Forwarding -> Always Forward -> Your voicemail number
Every phone I've ever seen has that option.

Would work but is cumbersome.

Turn the ringer volume to zero/set to not even vibrate.
This is slightly facetious answer, as the user will still hear the ring, and have to wait for Voice Mail to pick up, so it is probably not the ideal solution; but it's what I do when I'm in a movie or church or something.

Settings -> Wireless and network -> Mobile networks

or
Settings -> Wireless Controls -> Mobile Network Settings -> Mode of Operation

There should be a "Data only", "EVDO only", or similar option in there, depending on your phone.  My T-Mobile Vibrant does not have this option, for example, but the HTC Hero does.
Another possibility is:
Settings -> Call settings -> Voice call

There should be "Call forwarding" or "Call barring" options there that might do it, though they are greyed out for me.

First two don't exist for me on my phone.  Third works but is cumbersome.

If you use Google Voice, there is a simple "Do Not Disturb" option.

Does that work too if you are using GV for your cell # voicemail too?  I was going to test it out but I assumed that it wouldn't because unlike a real GV number its not being routed through Google system and would be able to head calls off at the pass.  Right?

Good point. No, it doesn't intercept it. But I only give out my GV number, so this is an option that works for me.


text:
Milestone rooted with the Universal Androot, can I install ROMs?
I rooted my Motorola Milestone 2.1-update1 with the latest beta of Universal Androot, and it seems to have worked fine. I've installed busybox, used titanium backup, and installed a couple root-only apps.
Now I'm thinking about using ROM Manager to see what custom ROMs can be installed. However, I'm worried because I've read the milestone has some sort of lock in the bootloader, and I never actually unlocked the bootloader while rooting it. Am talking sense? Will I run into problems if I simply install ROM Manager and try to install a custom ROM?
Correct me if I'm wrong, but I'm under the impression that rooting and unlocking are separate issues. And so I'm wondering if I don't have to unlock my phone before messing with ROM Manager.

In short, your phone has a locked bootloader.  There is no way to unlock it (currently).  What does that mean to you?  Basically it means you can flash "ROMs", but you cannot flash a new kernel on the phone.  The kernel is what controls what clockspeed slots are available on your phone to over/underclock to.
For example, if someone made a Gingerbread ROM for the Milestone, you could flash it.  But you will always be stuck with the same kernel that originally came with your phone.
As far as I know, you should be able to use ROM manager to flash ROMs on your phone so long as it is rooted.  It's just that none of these ROMs will be able to change your kernel.

Thank you for the clarification. What kind of features can I expect to miss due to not being able to change the kernel?

@Bruce The main thing you will miss without changing the kernel is being able to change the different clockspeeds that your phone can be set to.  For example, let's say your stock kernel gives you the options of 125mhz, 250mhz, 600 mhz and 800 mhz.  You will always be stuck with those on a locked bootloader. A new kernel could give you something like 250mhz, 600mhz, 800mhz, 1 ghz clockspeeds.  Or the kernel could undervolt the processor to conserve battery power.  Etc, etc.


text:
Is it possible to add 5GHz wifi capability to a Samsung A3 2016 through a dongle?
Question in title.
I have a drone I need to test which requires a 5GHz connection.
If it's possible to add 5GHz wifi capability through a dongle then I want to give it a go.

It's a Samsung A3 2016 (A310F). So it isn't possible to add 5GHz capability through an OTG device?

The problem with OTG devices is Android doesn't have the drivers and they can't be installed by regular users like on Windows either.

No. It's not possible
Your device doesn't support dual band (802.11 a or ac not supported) and adding OTG dongle that supports dual band isn't going to help. As an analogy, your service provider may provide WiFi but if your router ( like the older ones) doesn't support 5Ghz you can't use it in upper band

2017 model has that capability!


text:
Bluetooth USB on Android
Is there any way to add Bluetooth USB dongle support to Android OS? My version that I use for an embedded device doesn't contain any BT dongle support I think.  What has to be done to add this feature?
Note:
My device is ATMEL SAM9x5 EV Board. So Atmel, provide an Android BSP for this. But i think it's so simple adaptation for board. I'm not able to use "hciconfig" or "hcitool" commands even. 2 months ago, i contacted them but i can't reach correct man. Also i bought a bluetooth Uart module from CC&C (RTL8723) and i ported it to my Android BSP and Kernel but same result. Nothing worked. USB or UART not important for my project. So i'm not kernel specialist or system. My application is almost okay. EXcept bluetooth side.
 I have already done, I2C, GPIO and UART side. All are working. Also i'm able to change some kernel and framework specific things but not more. Just LCD customization and UART, GPIO stuff.And i decided to ask some stupid question to understand somethings.

You'll have to recompile the kernel and flash it to the board (or start it via other means); you also have to find the hciconfig/hcitool programs or compile them yourself, they're probably not part of the SDK kit.

Its possible by changing kernel to another one with support of features, needed to you.
You most probably need to recompile your own kernel. Since the Bluetooth card is connected to the USB subsystem, you will need to enable USB support in your kernel. This is what probably needs to be enabled:

Device Drivers → USB support → Support for Host-side USB (CONFIG_USB)
  Device Drivers → USB support → [*]USB device file system (CONFIG_USB_DEVICEFS)
  Choose an appropriate USB host driver, one of:
  Device Drivers → USB support → EHCI HCD (USB 2.0) support (CONFIG_USB_EHCI_HCD)
  Device Drivers → USB support → UHCI HCD support (CONFIG_USB_UHCI)
  Device Drivers → USB support → OHCI HCD support (CONFIG_USB_OHCI)
  Enable Bluetooth subsystem and drivers:
  Networking → <*>Bluetooth subsystem support (CONFIG_BT)
  Networking → Bluetooth subsystem support → <*>L2CAP protocol support (CONFIG_BT_L2CAP)
  Networking → Bluetooth subsystem support → <*>SCO links support (CONFIG_BT_SCO)
  Networking → Bluetooth subsystem support → <*>RFCOMM protocol support (CONFIG_BT_RFCOMM)
  Networking → Bluetooth subsystem support → [*]RFCOMM TTY support (CONFIG_BT_RFCOMM_TTY)
  Networking → Bluetooth subsystem support → <*>BNEP protocol support (CONFIG_BT_BNEP)
  Networking → Bluetooth subsystem support → <*>HID protocol support (CONFIG_BT_HID)
  Networking → Bluetooth subsystem support → Bluetooth device drivers → HCI USB driver (CONFIG_BT_HCIUSB)
  Networking → Bluetooth subsystem support → Bluetooth device drivers → [*]SCO (voice) support (CONFIG_BT_HCIUSB_SCO)

It's a standard linux procedure to enable it. You need to recompile it yourself however if those modules are missing.

For a lot of android devices available custom precompiled kernels from enthusiasts. Unfortunately author of question don't written, which device he use.

With the latest information you gave, result is same. I have already similar kernel config except _USB_DEVICEFS. Now i have ordered a specific chipset BT module. This may be ok. Or my Android has lots of hole. Thanks.


text:
How to work around "Your device does not qualify for bootloader unlocking" on Motorola devices?
I've followed the guides, but Motorola is telling me that I can't unlock the bootloader, so I'm blocked with
sudo ./fastboot flash recovery twrp-3.0.2-0-surnia.img
(bootloader) has-slot:recovery: not found
target reported max download size of 268435456 bytes
sending 'recovery' (16152 KB)...
OKAY [  0.509s]
writing 'recovery'...
(bootloader) Preflash validation failed
FAILED (remote failure)
finished. total time: 0.921s

I'm working from an Ubuntu box.

This is a known problem, mostly encountered with Chrome browser. Try Mozilla Browser to get the validation code. Unless i Misunderstood your problem

Same error in Firefox

Then it may be a different issue, you will need to search in Moto forums. You can perhaps try some other browser?

I checked https://motorola-global-portal.custhelp.com/app/answers/detail/a_id/87215, it appears that MOTO E (1st & 2nd Generation) is supported but not with 4G LTE which is what I have. I guess Motorola screwed up for its customers.

Sad. Please mention device on your question. If Motorola didn't give you the code, then it is a dead end

You can try trucks here but unlikely to work i guess http://forum.xda-developers.com/showthread.php?t=2658218&page=3

i don't understand! are you flashing the recovery before unlocking bootloader? because usually we unlock bootloader first with {fastboot oem unlock} command. is your bootloader unlocked already? if not then do so(on your own risk) . also you can try installing fastboot from Google repo instead of using it as binary from Android studio tools. benefit is it'll give you updated and bugfree version. also search for "preflash validation failed" error on moto E or any moto forums(xda) i got plenty of results that are similar to your problem

Spark, no, I just say that I can't flash because the bootloader is locked. @beeshyams moto xt1527 is the device in question and none of the solutions from XDA work for me, not even the SunShine unlocker.

Well, I was expecting it not to work as mentioned earlier, since OEM is yet to permit unlocking boot loader. Sorry for that, but best would be to chase OEM

You need to get the "cid" of the device by doing
./adb reboot bootloader
sudo ./fastboot getvar all

In my case it gives
(bootloader) cid: 0x0001

and as you can see at the official website, Lenovo/Motorola says "Your device is NOT eligible for bootloader unlock". You buy their phone and they still control it. Wait, what?

what do you use the cid for? I understand that that is what is says on the site, but why do I need to look up the cid?


text:
Restoring Titanium Backup's backups from SD
I'm on ROM that is based on Android Nougat 7.1. Using Titanium Backup, I backed up apps + data to the SD card and saw they were still there. I flashed a new ROM. I installed TB again but am having trouble restoring the apps. It can’t find the backups.
I went to Menu > Preferences > backup folder location > Storage provider > DocumentProvider storage > navigated to the correct location > pressed “Select”. Then the list populates with backups, but the “Use the current folder” is greyed out. I can only click cancel. However, if I make a new folder and navigate there, the “Use the current folder” is clickable. After clicking select the message quickly flashes “Access granted. Please create/choose a subdirectory for your backups”
How do I restore backups located on the SD card? I named the folder myself so it’s not like the default.

If the above suggestion didn't help try instead with File system storage,  instead of Document Provider

@DeathMaskSalesman well that was awfully unintuitive

It's been my observation sometimes I need to install an app (from the Play Store) before I can restore the data. For example, when I did find the right backup, the restore button was simply missing, but after I rebooted the phone and installed it from the Play Store, I was able to restore the data with TiB.

In order to successfully select a backup directory via the DocumentProvider storage, you should not navigate to the chosen folder immediately after choosing the abovementioned storage.
What you should do, is to navigate only to the root directory of the external SD card and then tap on Select. Next, after the Access granted popup appears, use Titanium Backup's built-in file explorer to navigate to the chosen backup directory, and then tap on Use the current folder.

I managed to do this by:

Navigating to the file in Solid Explorer
Selecting it and then "open with" > "Any" > Titanium Backup

If you changed (upgraded) the ROM version customizingly, i.e. KitKat to Lollipop, then Titanium Backup will fail to restore the app and data.
If you want to restore the backup anyhow, then you have to flash the previous ROM.

My ROM is AICP12.1 with Nougat, and I can restore backups from CM13 (Marshmallow), therefore your assumption is invalid.

I've been using TiBu for years, and it always restored apps & data for me, including after ROM upgrades and even after switching to completely different ROMs (e.g. from stock 4.1 to Cyanogen 4.3). It never failed me from 2.1 up to 5.1 – and though I didn't try yet, I doubt it will fail me on 6+ either. So while according to Aristotle one can derive everything from a wrong assumption, this is definitely wrong altogether.


text:
Still can't change Google Play country
I've tried:

updating my Google wallet (UK credit card & billing/home address).
setting default home address.
changing postal code on Gmail.
forcing stop and clearing cache on Google Play app.
clearing the browser cache (both on the phone and on the PC).
using a GPS spoofer + setting localisation to GPS only.

I live in the UK, but I bought my new phone back home (in the Faroe Islands).
This is my first Android device, so I'm new to the https://play.google.com.
The only thing I can think of that is causing it not to work, is the fact that I cannot purchase things in the Faroe Islands (in Google Play as well as https://play.google.com) Since all suggestions online say that I have to "buy" an app, then clear the cache, etc.
Any suggestions?
My device is not rooted and I'm running Marshmallow.

Just curious, why do you need to change your Country in Google Play?

Because I can't access paid apps, and most apps in general; Because the Faroe Islands is not properly supported. I live in the UK atm, so I just want to change the country of my Google Play in order to get past this limitation

I tried all these steps earlier today. I rebooted as well. It has been about 6 hours and it finally started working. Also, something else to note, I browsed the google play store and looked at paid apps. Not sure if that matters. But finally, while I was browsing, my countries apps appeared.

I tried some solutions to change an old country to a new country but I couldn't do it so I finally restored my android phone then the problem was solved.

@Kai, I just stuck with my UK store, until recently, when they decided to support the Faroe Islands. So this is no longer an issue for me :)

Method 1 (Requires 2 Phones signed in with same google account):

Phone 1:

Open Google Play Store and Download HotSpot Shield or Zenmate.  Once
you have downloaded.
Clear cache and data of Google Play Store by going into Settings ->
Apps -> Google Play Store.
Now open VPN app (Zenmate) and Change your location to UK and connect
the VPN. Open Google Play Store and Accepts the terms.
Accept the terms.
Now Move out of Google Play Store.
Do not exit the app from the background.

Phone 2:

Now perform the following steps on Phone 2.
Clear cache and data of Google Play Store on Android Phone.
Open Google Play Store. You don’t need VPN on this phone.
This time, accept the terms and rules. It will take you to UK’s
Google Play Store.

Phone 1:
Disconnect from VPN and Head back to Google Play Store.

Method 2: (Same thing on a single phone, but you will need VPN everytime you use Play)

Install the VPN app provided by your VPN provider on your Android
device.
Choose a VPN server belonging to UK.
Establish a VPN connection.
On your Android device, go to Settings -> Apps.
Under “Downloaded”, search for the Google Play Store app.
Click on it.
Press “Clear Data” and “Force Stop.”
Exit settings.
Relaunch the Google Play Store App.

I have tried Method 2, it worked for me.
For both methods, you need a VPN which provides a UK server(free/paid depending on you).
Set server locations where you want your Google Play location to be, most of the VPN's provide free access to US servers.

I had a similar issue moving from Germany to the UK and spent over an hour on the phone with Google support.
In addition to what others already wrote above, I had to do two things:

Cancel any Google subscriptions you have on your old profile (I had to cancel my Google Play Music Family Plan)
Make sure you not only add a new country profile on pay.google.com, but also add a payment method from the new country

It takes between 24-48 hours for the Google system to process the new profile and to authorize the new payment method.
Only after waiting that long could I do what the others described: cleared cache and storage of the Google Play app (under Apps & Permissions on Android 9) and the new profile finally appeared under Accounts. It is crucial that at this point you need to have an IP address locating you in the country of the new profile, so you might need to use a VPN.
If none of this helps, the support also recommended to sign out of the Google account on your phone and sign in again.

I had the same problem when I moved from the US to India a week back. Here are the steps I used to resolve this issue.
Go to Google Payments and create a new profile for the UK

Go to https://payments.google.com, click on your current profile, and click on the edit option (symbol of a pen) available next to your listed country.
Now you will get an option to add a new profile for a different country

Go to Google Play Store and change the profile

Click on Settings and select the Country and Profiles option.
Here you will be shown both the countries corresponding to your profiles which were created in Google Payments
Select UK and start using Google Payments. Do remember that you can only change the country once every year.

I also had more than 20 dollars in my US profile, so I first spent the money on some useful apps to bring it below 10 dollars and then switched the profile. You need not do this if you don't have money in the old profile. Also, you don't need to buy anything from Google  Store, just to change countries.

For me this was the most helpful answer, although the last steps were a little different. To change to the new profile, I went to hamburger menu -> Account -> Country and Profiles. I had the second country listed with a checkbox next to it, I clicked it and that was it.

Go to Google Payments and create a new profile. Enter new country and other details. (you can go to Google Payments by clicking payment methods in the menu in the Play Store. Then choose more payment settings)

Force close Google Play Store and 2 other Google Play services in apps in your phone settings.

Open Google Play Store. Go to account. You'll find countries and profiles.

Google is making it easier, as reported today, to change the country to a different one. From Android Police on 2018/03/20:

Now, Google appears to be taking one teeny tiny step toward making the switch easier for some people. If your Play Store country is set to country A (whether you lived there or, uhm, fooled Google into thinking you did because you made a purchase with a valid payment method and to a valid shipping address in that country), and the Play Store detects that you've moved to country B (likely based on your IP address), you'll get a new option in the Account settings: Country and profiles. There you'll see which country your Store account is on and an option to quickly switch to the new country - provided you have a valid payment method there.

There are some caveats to this:

Keep in mind that this Country and profiles option won't be there for everyone and won't let you switch to any country you want. It appears to only show up when it detects a discrepancy between your setting and your IP address.

What if I has no payment profile (no payment method) yet? What country is bound to my account?

@Suncatcher the original one. This answer is not correct (and Google is lying), because without a Payment Method from the intended country, the new country will never appear as an option. Source: me, since 2016 to 2024.

the original one ok, how to check the original country in the settings?

First, log in to the browser by the URL https://payments.google.com
Select the menu, create a new payment method, fill in details in the fields, save it, and log out of your Google account.
Open Google Play Store, go to the menu, account, and select your newly added country.

I had the same issue and the easy answer was that I had to change the country in my https://pay.google.com, that is where it was taking the wrong country from.
After I changed the address associated with my payments, the change country option became available in the Google Play profile, and I could change from Hungary to Spain.


text:
Do I need specific cable for fast charging Samsung Galaxy S6?
My Samsung Galaxy S6 fast charging cable has broken and I was wondering whether I needed to buy a cable specifically for fast charging, or just a regular media cable.
The fast charging plug socket isn't broken, it's just the cable.

Fast charging is not related to the cable - the circuitry is in the adapter and device. That said you need to buy a cable that can carry higher amperage , allowing fast charging speed ( cable per se doesn't increase the speed but because it permits more power, speed is increased)
Thicker the cable, better it is ( thicker cables have lower AWG number )
Go in for a cable like
Tronsmart cables at a price comparable with budget cables. These are 20 AWG thickness for charging (provide best charging) 28 AWG for data (thinner thickness doesn't affect data transfer speeds)
For technical details of a good quality cable see my answer here
I am not affiliated with the product- a very satisfied user

Thanks for replying. So will the amperage affect the charging speed?

Yes. If cable can't  support higher amperage, speed is decreased.  If the answer meets your expectations, you may accept it by clicking the green Arrow next to up / form votes

You'll want a quality cable, but the important part is the fast charging adapter itself, and if that's not broken or anything then you should be able to use any good quality cable.


text:
How to permanently remove a particular Chrome notification from Android mobile phone?
I visited a website yesterday. Today, a notification popups every time my mobile phone is rebooted, showing me that website (it is grouped under "Social digest"). However, when I click on that notification, it only takes me to Chrome but not to that website.
How to permanently remove this notification?

Open Chrome → Settings → Site settings (under "Advanced") → Notifications and click on it.
The following screen will appear

If you turn off the Notifications slider, you will not get any notification from Chrome at all (from sites).
To turn off for a particular site, click on Allowed → [URL of the site] → Notifications (under "Permission") → change "Allow" to "Block".

If you want to delete notifications for specific sites in the list. You have to manage in storage of application by going Android's Settings > Apps > Chrome > Storage > Manage Space > Manage.
From there, select the domain URLs that you do not want individually, which will show its "Site settings", then select the trash can next to "Usage" and select "Clear all".

i dont think it works though

Im on a samsung s10. I went to storage>manage storage on bottom left>    then clicked free up space and manage. not sure if clear all data is good to do.

If you go to the "More info" section of the Chrome app (Android's Settings > Application Manager > Chrome), uncheck "Show notifications". This will turn off all notifications for Chrome.

In the "Settings", I have "Basics" and "Advanced". In the "Basics", I have "Search engine", "Auto-fill forms" and "Save passwords". In the "Advanced", I have "Privacy", "Accessibility", "Site settings", "Date saver" and "About Chrome". I cannot find "application manager".

I have at last worked out how to remove notifications permanently from Chrome on Android:

Press the three dots at the top-right of Chrome
Go to Settings
Select Notifications
Scroll all the way to the bottom and press the Advanced button, then press Additional settings
Now you should find yourself in the notifications section of Chrome. You can see both Blocked and Allowed notifications by going through the different addresses
Click on each of the sites you wish to remove, you will be given the option:
Clear and Reset - press this if you want to remove the notification from your phone in its entirety

Seems that Google is continuously moving this setting. As of today, this is how I removed the notification settings for a specific site. I'm on a Samsung Galaxy Tab S6 lite.

Three dots at top right
Settings
Site settings
All sites
Select specific site
Clear & reset


text:
How to install US/European ROM on Chinese Galaxy S7 Edge?
I have recently bought a Samsung Galaxy S7 Edge (SM-G9350) from China, and there are no Google apps, and I still find a lot of text in Chinese (yes I changed the language), and the apps still contain Chinese.

I've never dabbled in installing ROMs or even rooting my phones but I'm a very quick learner. Also, I don't mind if the ROM isn't official, I do plan on rooting the phone eventually.
Was there any way to install the US or European ROM on it?

European/US ROMs have to be ported in order to work, but there isn't one that I know of, since the majority of us Chinese value Samsung Pay heavily, and with a non-stock ROM Samsung Pay capability is bombed.
However, at the same time, the G9350 variant is also sold in Hong Kong, which has GAPPS, is more internationalized (presumably with English), and with no hardware difference. You could try out one of its factory firmwares by flashing it via Odin. Brief guidance is on the download page.
EDIT: I've seen your screenshot - from the baseband version, it's quite obvious that your device is not a G9350 - rather, a G935V (Verizon variant) flashed with ported G9350 firmware (see what I said about ported firmwares?). In this case you need to go with G935V factory firmwares.

Comments are not for extended discussion; this conversation has been moved to chat.


text:
How can I open /data/data/com.termux/files?
I am unable to access the /com.termux/files folder. I want to access it because I want to do a change in writer.js files.
I tried cd.. and cd - codes to go back to files folder from home folder.

Does opening Termux and cd .. work?

No it doesn't work

In order to get to the Termux files folder, you have to CD to the entire path name like this.
cd /data/data/com.termux/files

From there, you can cd into the usr folder and wherever you want to go. Once you find writer.js, you can edit it using nano which comes with Termux. Enter nano writer.js, make your edits, and then use CTRL+O to save it and CTRL+X to exit nano.
Then you can get back to your home directory with:
cd ~

Hey Thanks for your help but can u tell me how can i open writer.js file in termux after into a certain directory.I want to edit writer.js

@rohitsingh Get a text editor like vim or emacs.

How to install them and how to open writer.js with them. By the does it work on Android

@rohitsingh Mine may be a stupid question, but here goes: why don't you move the file you wish to edit inside your internal storage, edit it with a GUI editor and put it back where it was?

You install packages on Termux with the pkg comand, such as pkg install vim. But try pkg install ne instead -  it's easier to use. Then type ne writer.js and tap Esc to view the menu.


text:
How can I check which applications have been granted root access?
I have an SGS i9000 with Android 2.1 and I installed a lot of applications before I fully understood what "root" was.  Now I naturally want to review which applications I gave root access.  How can I do this?

If you root your device using one of the more modern methods, then you should have a SuperUser.apk installed that will prompt you before any apps are given root access. The SuperUser application also keeps track of the applications that have been given root access.
If you don't know about rooting, there is no way you have an apps that uses root except if your phone is a second hand, and the previous owner did not wipe and reinstall a stock firmware.


text:
How do you resize the Gmail widget?
I can't seem to get the Gmail widget resized to full screen on my SG2. How do I resize it so that it covers the whole screen area?
Android 4.0.4.

If you're using the stock launcher, you can't.
If you use an alternative launcher like Nova Launcher or Apex Launcher (one which has support for scrolling & resizable widgets), then you can. Put the gmail widget on your homescreen by long-pressing and selecting the label of choice. THen long-press the widget itself and from the popup menu, choose RESIZE and resize the widget's dimensions as per your liking.
You haven't mentioned what version of Android you're using and Nova/Apex work only on v4+ (ICS). If you have an older gingerbread version, try ADW launcher. Instructions are similar, if not exactly the same.
You may also have to enable the functionality for "scrollable widgets" from within your launcher's settings panel to get the full benefit.


text:
4.3 Galaxy S4: how do I prevent keyboard backspace from deleting whole word?
I've just updated my Galaxy S4 (T-Mobile, in case that matters) from 4.2.2 to 4.3.  Now when using the keyboard (default settings), if I get to the end of a word -- either strictly on my own or via one of its suggestions -- and then backspace, it deletes the whole word.  Before, backspacing at that point deleted one character at a time.  Often it's faster for me to correct a suggestion (or notice and fix a typo of mine) this way than to start over with that word.  I'd like my phone to stop being so aggressive in cleaning up after me.
I don't remember setting something for this in the previous version (though it's been a while).  I've walked through the settings for the device and in Twitter and Messaging (the apps where I've noticed this behavior so far), but haven't found anything that seems relevant.  I have not rooted my phone and don't plan to.
Current settings, under Device -> Language & Input:

Default: Samsung keyboard
Samsung keyboard settings:

predictive text: on
auto replacement: off
auto capitalization: on
auto spacing: on
auto punctuate: off

Keyboard Swipe:

SwiftKey Flow on
Cursor Control off

Aside from auto punctuate (which I turned off), these settings are as they came after the upgrade.

SwiftKey has never done this for me on any version of android on an S4... Swype does it by default.. I've just tried it here and it doesn't do it in any of those apps... Maybe reinstall your keyboard?

I never got this working (and didn't download a different keyboard), but I recently received the update for 4.4.4 and it's working now.  So I don't know if it was something specific to Samsung (or my provider, T-Mobile), but the whole-word deletion has stopped.

If I may, I suggest KK Keyboard. I'm not advertising, but I use it myself, because my keyboard did this too.


text:
Power button fails to work consistently on Motorola Droid. Workarounds?
When I press the power button on my Motorola Droid, nothing happens (usually). Just to get my phone to turn on after being shutdown, I have to plug it in to the charger cable. Once booted, however, I still have no convenient way to turn the screen on and off, or to shutdown the phone gracefully. Is there anything I can do to make the phone usable?
Note that a similar question has already been asked, however that question is specifically for non-rooted Droids, whereas my phone is rooted.

As long as your phone is rooted, you can use the excellent Button Remapper app by appelflap as a convenient workaround. What the app will let you do is remap the camera button to work as the power button.

After installing the app, find the entry for "(Camera)" and set its Action to "Power" and its State to "WAKE_DROPPED". (WAKE tells the key to register even when the screen is off; WAKE_DROPPED does the same but drops the key before it is sent to the running application.) Optionally, remap the "(Power)" button to something innocuous like "Home" and set its state to "NONE" — that way, in case the real power button becomes active in a jammed state, the button input shouldn't mess up anything you are trying to do on the phone. After you are satisfied with your changes, click "Apply" to reboot the phone for the changes to take effect. In case you messed up, there will be a notification from Button Remapper in the status bar, which will let you reset any changes you have made.
Note that even when using Button Remapper to remap the hardware buttons, the remapping will not take effect when the phone is off (or you are booted into recovery mode). If your power button doesn't work, you will still have to use a workaround like plugging your phone into a charger in order to get the phone to power on from a shutdown state.
Seeing as how the power button design on the Motorola Droid appears to be partially defective (I know of at least a handful of Droid owners who have had the power button fail), on my replacement Droid I made the point of remapping the Camera button pre-emptively, in an attempt to minimize wear and tear on the power button. It's something to consider.

Unfortunately I don't know any other way. You might have luck asking it as a new question here on this site — maybe someone else knows of another way.

To do it when the phone is turned off:
Plug it in to power while holding down the 'x' key until a warning sign shows up on screen.
Different versions seem to differ here, but:

It might boot straight away.
You might have to hold down the volume up and camera keys, then select 'reboot phone'.
You might have to press the search button, then select 'reboot phone'.


text:
Where is a downloaded .apk placed in Android phones?

Possible Duplicate:
Where in the file system are applications installed?

Where is a downloaded .apk placed in Android phones? I want to backup the .apk files to my PC so that if something happens I will just restore the applications instead of re-downloading them from market.
I'm using a Samsung Galaxy S II.

If you don't have root access, it doesn't matter because you won't be able to back them up.
If you do have root access, use an app like Titanium Backup to back up the apks.
Note:
This doesn't really answer the question of where to find the downloaded APKs, but it does address the need of the OP.

While a very good answer to the asker's situation, it would be nice if it also actually answered the question listed as the title, or at least noted that it doesn't answer it for a purpose.

@IlariKajaste: good point. I edited the answer.

They're (mainly) in /data/app.  If you're rooted, you can also back them up to your computer via ADB:
adb pull /data/app/ C:\backup\

(Or similar command).  To restore the easiest might be to copy them to your SD card, then go through them on your phone and install one by one.
Titanium is much better though, so listen to Nathan.


text:
Can I lock desktop icons on X10 Mini Pro?
Is it possible to lock the icons & widgets (i.e. disable the long-press-to-move function) on the Sony Ericsson X10 mini pro?
I saw this question - Lock widgets in place - but it seems i may need to root the phone, and besides this issue, i am quite happy with the standard user interface.

Could you confirm whether you have the Xperia X10 mini pro or the Xperia mini pro?  Confusingly, they're not the same phone.

X10 mini pro, not the new Xperia mini pro.  It's running Android 2.1

It would seem as the only solution is to install ADW Launcher, as suggested in the other question.
And no, you don't need root to install ADW Launcher.
If you do decide to change launcher to ADW Launcher, Here's a link on how to lock the screen on the Complete guide to ADW.Launcher

More research shows that the beta versions required root, but it is available from the Android Market now.  I'll give it a try as soon as I've got time to play :-)  Thanks

Pity that it's not a default function of Android to simply "lock" the home screen layout.  The X10 mini pro interface is actually nicely tailored to suit the tiny screen practically.

Tried it and it actually works very well!  Thank you.

I'm glad to be of help :)

You can use Nova Launcher. In Nova Settings, Desktop > Lock Desktop.


text:
How to get warning if there is an e-mail?
I know how to set vibration when getting an e-mail: How to set vibration ON when getting e-mail (Gmail)?
But how can I set my Android phone to always vibrate/give sound when getting an e-mail?
I'm asking it because once I get an e-mail, my phone will stay silent, even if I get another e-mail. I need a feature/setting that enables this, to have a warning, when a message arrives.

Uncheck the "Notify Once" option in your GMail account settings and you should get a notification for every new message.
(Specifically: Menu -> More -> Settings -> Notify Once)
Edit: Apparently older versions of GMail do not have this option, in which case you would actually need to try a third-party app such as GMail Notifier.

sorry for asking, but where is this "Specifically Menu" :D

I'm using Android 2.1-update1 and I can't find it. In the Gmail app I go to Settings -> and I can't find a "more" menu :O

@LanceBaynes: "More" is displayed when you press the menu button, not in the settings screen.

If I press the menu button then it says: Refresh/Compose/Accounts/View labels/Search/Settings

Then just select "Settings". The "Notify Once" option should be at the bottom of the settings, unless it was added after 2.1 (in which case you'd need an app like GMail Notifier, I guess).

yep, it's not in this version: in the Notification settings there are: Email notifications, Select ringtone, Vibrate..

@LanceBaynes: Ah, definitely should be right at the bottom of that section. I added the GMail Notifier app to my answer since it looks like it is attempt to solve the problem on older Android versions. Must have been added at some point after 2.1...

i tried the gmail notifier out. it works perfectly. thank you!

I reseted my phone, and I can't find the "gmail notifier"??? - where is it?? was it trojaned or what??


text:
Custom roms for specific use cases
I've seen this - Where can I find a good comparison of available custom ROMs?
However the release matrix linked to doesn't really do what it could do.
Is there an objective comparison somewhere that details the ROMs available by feature?
I'd like to find a ROM that's good for battery life and speed.
The phone model is a Galaxy S I9000.

No one will run the same apps with the same settings in the same environment as you.  Any "objective" evaluation will be no more useful than reading the XDA forums, for example; you're going to end up with an indication of reliability and speed, nothing more.
There's also a ton of ROMs for the SGS, many of which are only published certain places (XDA, MoDaCo, ROM-specific forums).  You'd be hard pressed to find a complete resource.  Even the "ROM Guide" threads on XDA tend to fail to include many of the ROMs from XDA.
In sum, I'd read the XDA Android Development subforum for the i9000 and shortlist a few ROMs that sound good to you, then test them out and see what works best for you.


text:
wDisplay Android hotspot in macOS Wi-Fi menu
Preface: I suspect the answer is "no", but I reckon I'd shoot my shot.
MacOS has an auto-discovery called Instant Hotspot feature for shows nearby iPhones that are available to provide a hotspot. These are listed in the WiFi menu along with their battery level and cell signal strength.
Crucially, this appears before a hotspot has actually been started. Clicking on the menu entry will remotely enable the hotspot on that iPhone.

Has anybody managed to make an Android app that let's an Android play ball with this feature?

If this feature relies on iCloud accounts (I don't think it does, I can see strangers' hotspots) or some central registration server, then this will obviously not work. On the other hand, if it's just using some local WiFi frames, then it seems plausible to reverse engineer and spoof. Is there any existing work on this?

I don't know exactly how this feature works, but based on your description it can not only works using WiFi. My guess is that is uses Bluetooth to detect nearby devices. As MacOS and Icloud are closed source systems and Android devices don't contain an Apple certified secure enclave (which is used most likely by the Apple devices for mutual authentication) I don't see high chances to port such a functionality.

@Robert I think it's most likely that they're using 1) They could be broadcasting availability with special frames at the PHY layer (802.11 WiFi), 2) they could be using Bluetooth. It's possible to lock down the feature using a private key only found in legitimate iPhones, but if it's not, it should be possible to replicate on other systems. If no one has already done so, I could look into myself and share my findings!

There's a comment on a slightly related question, Make iPhone hotspot always detectable on Android phone on [Apple.SE]: "Apple devices know the hotspot is there, because they're all logged into the same Apple ID, and use BTLE to ask the iOS device to actually turn the hotspot on."

According to this answer on Apple.SE, the feature is called Instant Hotspot and it relies on both WiFi and Bluetooth enabled on Apple devices.

Ah yes, I'll incorporate that name into my question, thanks for sharing! "... because they're all logged into the same Apple ID, ..." I'm skeptical of this. In crowded public spaces I often see multiple strangers' iPhones who most definitely (hopefully!) aren't on my Apple ID


text:
Manually starting wpa_supplicant
I can start wpa_supplicant just fine through adb shell. The firmware and stuff for my WiFi radio is all loaded before this.
However, I want to start it via execv() in a C program. When I execute execv(), I get the following error:
E/wpa_supplicant( 3008): Failed to initialize control interface 'wlan0'.
E/wpa_supplicant( 3008): You may have another wpa_supplicant process already running or the file was
E/wpa_supplicant( 3008): left by an unclean termination of wpa_supplicant in which case you will need
E/wpa_supplicant( 3008): to manually remove this file before starting wpa_supplicant again.
I/wpa_supplicant( 3008): ELOOP: remaining socket: sock=15 eloop_data=0xa5320 user_data=0x0 handler=0x6acd9

I also have this in the serial console:
mkdir[ctrl_interface]: Permission denied

The full strace ouput is here: http://pastebin.com/fuQnqjXK
Here's the strace output snippet of interest:
2380  mkdir("wlan0", 0770)              = -1 EACCES (Permission denied)
2380  write(2, "mkdir[ctrl_interface]", 21) = 21
2380  write(2, ": ", 2)                 = 2
2380  write(2, "Permission denied", 17) = 17
2380  write(2, "\n", 1)                 = 1

Also, here's the logcat snippet. I've already verified that there's no wpa_supplicant running in the background, and the file that is created when wpa_supplicant is successfully run (/data/misc/wifi/wlan0/wlan0) does not exist. Are there other files that wpa_supplicant is creating?
D/wpa_supplicant( 3627): wpa_supplicant v0.8.x
D/wpa_supplicant( 3627): random: Trying to read entropy from /dev/random
D/wpa_supplicant( 3627): Initializing interface 'wlan0' conf '/data/misc/wifi/wpa_supplicant.conf' driver 'nl80211' ctr
_interface 'N/A' bridge 'N/A'
D/wpa_supplicant( 3627): Configuration file '/data/misc/wifi/wpa_supplicant.conf' -> '/data/misc/wifi/wpa_supplicant.co
f'
D/wpa_supplicant( 3627): Reading configuration file '/data/misc/wifi/wpa_supplicant.conf'
D/wpa_supplicant( 3627): update_config=1
D/wpa_supplicant( 3627): ctrl_interface='wlan0'
D/wpa_supplicant( 3627): eapol_version=1
D/wpa_supplicant( 3627): ap_scan=1
D/wpa_supplicant( 3627): fast_reauth=1
D/wpa_supplicant( 3627): config_methods='push_button keypad display'
D/wpa_supplicant( 3627): device_name='U8500'
D/wpa_supplicant( 3627): default_bgscan='learn:60:-70:300:10:20:/data/misc/wifi/wpa_supplicant_bgscan.db'
D/wpa_supplicant( 3627): wmm_enabled=1
D/wpa_supplicant( 3627): uapsd_enabled=1
D/wpa_supplicant( 3627): nl80211: interface wlan0 in phy phy0
I/wpa_supplicant( 3627): rfkill: Cannot open RFKILL control device
D/wpa_supplicant( 3627): nl80211: RFKILL status not available
D/wpa_supplicant( 3627): nl80211: Set mode ifindex 5 iftype 2 (STATION)
D/wpa_supplicant( 3627): netlink: Operstate: linkmode=1, operstate=5
D/wpa_supplicant( 3627): nl80211: Using driver-based off-channel TX
D/wpa_supplicant( 3627): nl80211: driver param='(null)'
D/wpa_supplicant( 3627): wapi_initialization()
D/wpa_supplicant( 3627): wlan0: Own MAC address: 00:80:e1:c2:89:9a
D/wpa_supplicant( 3627): Country: 00
D/wpa_supplicant( 3627): wpa_driver_nl80211_set_key: ifindex=5 alg=0 addr=0x0 key_idx=0 set_tx=0 seq_len=0 key_len=0
D/wpa_supplicant( 3627): wpa_driver_nl80211_set_key: ifindex=5 alg=0 addr=0x0 key_idx=1 set_tx=0 seq_len=0 key_len=0
D/wpa_supplicant( 3627): wpa_driver_nl80211_set_key: ifindex=5 alg=0 addr=0x0 key_idx=2 set_tx=0 seq_len=0 key_len=0
D/wpa_supplicant( 3627): wpa_driver_nl80211_set_key: ifindex=5 alg=0 addr=0x0 key_idx=3 set_tx=0 seq_len=0 key_len=0
D/wpa_supplicant( 3627): wlan0: RSN: flushing PMKID list in the driver
D/wpa_supplicant( 3627): nl80211: Flush PMKIDs
D/wpa_supplicant( 3627): wlan0: State: DISCONNECTED -> INACTIVE
I/wpa_supplicant( 3627): WPS: Converting display to virtual_display for WPS 2.0 compliance
I/wpa_supplicant( 3627): WPS: Converting push_button to virtual_push_button for WPS 2.0 compliance
D/wpa_supplicant( 3627): nl80211: Regulatory information - country=00
D/wpa_supplicant( 3627): nl80211: 2402-2472 @ 40 MHz
D/wpa_supplicant( 3627): nl80211: 2457-2482 @ 20 MHz
D/wpa_supplicant( 3627): nl80211: 2474-2494 @ 20 MHz
D/wpa_supplicant( 3627): nl80211: 5170-5250 @ 40 MHz
D/wpa_supplicant( 3627): nl80211: 5735-5835 @ 40 MHz
D/wpa_supplicant( 3627): nl80211: Added 802.11b mode based on 802.11g information
D/wpa_supplicant( 3627): WPS: Set UUID for interface wlan0
E/wpa_supplicant( 3627): WPS: UUID based on MAC address - hexdump(len=16): b2 15 b7 6a cb d7 55 cf b9 d4 3e 8c 40 ae 2d
30
D/wpa_supplicant( 3627): EAPOL: SUPP_PAE entering state DISCONNECTED
D/wpa_supplicant( 3627): EAPOL: Supplicant port status: Unauthorized
D/wpa_supplicant( 3627): EAPOL: KEY_RX entering state NO_KEY_RECEIVE
D/wpa_supplicant( 3627): EAPOL: SUPP_BE entering state INITIALIZE
D/wpa_supplicant( 3627): EAP: EAP entering state DISABLED
D/wpa_supplicant( 3627): EAPOL: Supplicant port status: Unauthorized
D/wpa_supplicant( 3627): EAPOL: Supplicant port status: Unauthorized
E/wpa_supplicant( 3627): Failed to initialize control interface 'wlan0'.
E/wpa_supplicant( 3627): You may have another wpa_supplicant process already running or the file was
E/wpa_supplicant( 3627): left by an unclean termination of wpa_supplicant in which case you will need
E/wpa_supplicant( 3627): to manually remove this file before starting wpa_supplicant again.
D/wpa_supplicant( 3627): Failed to add interface wlan0
D/wpa_supplicant( 3627): wlan0: No keys have been configured - skip key clearing
D/wpa_supplicant( 3627): wlan0: State: INACTIVE -> DISCONNECTED
D/wpa_supplicant( 3627): wpa_driver_nl80211_set_operstate: operstate 0->0 (DORMANT)
D/wpa_supplicant( 3627): netlink: Operstate: linkmode=-1, operstate=5
D/wpa_supplicant( 3627): EAPOL: External notification - portEnabled=0
D/wpa_supplicant( 3627): EAPOL: Supplicant port status: Unauthorized
D/wpa_supplicant( 3627): EAPOL: External notification - portValid=0
D/wpa_supplicant( 3627): EAPOL: Supplicant port status: Unauthorized
D/wpa_supplicant( 3627): wlan0: No keys have been configured - skip key clearing
D/wpa_supplicant( 3627): wlan0: Cancelling scan request
D/wpa_supplicant( 3627): wlan0: Cancelling authentication timeout
D/wpa_supplicant( 3627): nl80211: Set TX rates failed: ret=-22 (Invalid argument)
D/wpa_supplicant( 3627): netlink: Operstate: linkmode=0, operstate=6
D/wpa_supplicant( 3627): nl80211: Set mode ifindex 5 iftype 2 (STATION)
I/wpa_supplicant( 3627): ELOOP: remaining socket: sock=15 eloop_data=0xa5320 user_data=0x0 handler=0x6acd9

Anyone can hint to me what I might be doing wrong? Permissions?

have you tried to 'strace -f' your problem? Seems like you start it from an app, right? You probably need to start it as root.

I'm starting it from a C program (let's call it myapp) that I compiled for ARM, and myapp is from init.rc as a replacement to console (a bit of a hack really) so I can't really strace -f right? When I do a ps myapp, it shows myapp running as root.

you could do that as well (and write stderr of 'strace' to some /tmp folder to read it later). What I guess is: wpa_supplicant needs some location where it can store some tmp stuff to. You are launching it too early maybe and there's everything still read-only accessible. You can do a manual 'strace -f'  just to see where it wants to write to.

Thanks ce4. But how do I do that? Using execv and strace? By the way, when I do a ps in adb shell after getting the mkdir[ctrl_interface]: Permission denied, I get wpa_supplicant running as user wifi. I suppose I must force wpa_supplicant to run as root?
ps wpa_supplicant
USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
wifi      2611  1426  0      0     c009c348 00000000 Z wpa_supplicant

Use strace just by doing a 'strace -f myapp' with your parent C program (-f is for following childs).

Hi ce4, I did it another way. http://elinux.org/Android_Booting#strace
For easier viewing I've included part of the strace in an answer below.

Hi ce4, edited my original post. I'm new to stack exchange's working culture, so pardon me mods. I also added the workaround solution I found.

No problem, just come back again if you have questions of feel like getting involved in answering questions :-) (Sorry for my last comment, typed that quickly on my non-english auto-correcting handset, thus the bad typing).

Side-note: This question is on the edge from power-user to developer related. You can also ask the more dev related stuff over at stackoverflow.com (it might also be migrated over from here as this is a sister site). Just FYI.

I managed to find the answer, although I don't really understand why or how. If anyone can add on to why working directory matters, I will greatly appreciate it.
In my C program, I have to do a chdir() to /data/misc/wifi, then do the execvp().
if (chdir("/data/misc/wifi") == -1) {
    perror("chdir");
    return;
}

pid = fork();
if (pid == -1) {
    perror("Error forking process");
}
else if (pid != 0) {
    return;
}
execvp("/system/bin/wpa_supplicant", wpaparmlist);

where wpaparmlist is the args to wpa_supplicant.
Thanks for your help ce4!

Maybe wpa_supplicant checks if it's run from within a terminal or forked by another program - or- you recently launched it in the /sdcard folder where it has also all rights to modify files / mkdir.


text:
Are GPS-tracking apps data dependent?
Are GPS-tracking apps data dependent or will devices use GPS signals alone, to notify their locations?
I am looking for a GPS-tracking app to track family members on a trip where we gonna have limited network coverage, and in some areas no coverage at all.
I am not sure if these apps need data connection to send the location to another device, or they would only use GPS signals.

It's not entirely clear from your question what exactly you mean by "tracking". If you only wish to record a log of where the device has been (so you can look at it later, or retrace your own steps), then you don't need any internet access for that. The device just receives the GPS signal, calculates its position, and saves that position to a file every so often. There are many apps that can do this: some of them are intended for sports, and offer features like finding your top speed, or comparing your time over a certain route with your friends; others are designed for making your own maps, or geotagging photos made on a real camera.
However, it sounds like you might want different devices to tell each other their positions, using something like Google Maps "location sharing", so that you can find where family members are right now. Obviously that would require internet access (whether that's 3G or Wi-Fi) so the devices can communicate with each other. The GPS receiver is exactly that: it receives signals from satellites to determine its position, without transmitting anything. GPS only tells you where you are, not where anyone else is.

Yes, we need to know each other's location. I didn't know smartphones are only receivers... thanks for the help.

@Omne It's not just smartphones. All GPS receivers are only receivers: even the ones you get in your car, or the handheld units you use for hiking. Only the satellites transmit anything.

While a data connection might prove helpful for a faster fix (see: AGPS), it's not strictly necessary to have one. There a a lot of "Offline GPS Apps" available. I personally e.g. used Locus Maps successfully for that in the past, but there are plenty of similar apps available.
Tracks can be stored on the device, of course, and do not need to be sent to a server for the tracking process itself. Most apps allow to export them later in GPX or KML formats.
If, however, you want to now the position from a "remote device" (as your updated question shows, to e.g. know where your kids are at the moment), that cannot work via GPS alone, as GPS signals are only received by our devices, not sent. So this requires at least some kind of coverage: solutions are available to exchange data by different means, e.g. via internet (requires mobile data) or by SMS (still requires a network signal).