Amazfit Watch 2 - TrainingPlan data lost after re-pairing - Amazfit

Hi,
need your help with TrainingPlan app.
After reinstalling Amazfit Watch app, I had to pair the phone with watch again. Don't know why but after sync, TrainingPlan app got wiped.
It's not that big of a deal, because all the activities are still recorded on the watch/mobile/strava but I was in the middle of half-marathon training plan and would like to continue it.
In order to restore/recreate this data, I need to know how exactly this app is storing it.
I have already reviewed the source code available on gitlab.com - /Neuer_User/PACEfied_AmazFit
I have also downloaded the TrainingPlan.apk directly from the watch (with adb) and decompiled it (apktools) and reviewed the app in IDE.
Here is the content of AndroidManifest.xml from TrainingPlan:
Code:
...
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permisison android:name="com.huami.watch.permission.RECEIVE_WAKEUP"/>
<uses-permission android:name="com.huami.watch.permission.READ_USER_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.huami.watch.permission.READ_USER_SETTINGS"/>
<uses-permission android:name="com.huami.watch.companion.permission.READ_SETTINGS"/>
<uses-permission android:name="com.huami.watch.companion.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="com.huami.watch.permission.READ_USER_SETTINGS"/>
<uses-permission android:name="com.huami.watch.permission.WRITE_USER_SETTINGS"/>
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:name=".TrainApplication" android:supportsRtl="true" android:theme="@style/train_center_theme">
<meta-data android:name="com.huami.watch.launcher.springboard.PASSAGER_TARGET" android:resource="@array/spring_depend"/>
<activity android:name=".ui.test.TestProvider"/>
<activity android:name=".ui.activity.TrainPlanSimpleSelectActivity" android:theme="@style/train_center_theme">
<intent-filter>
<action android:name="com.huami.watch.train.ui.activity.TrainPlanSimpleSelectActivity"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:name=".ui.activity.TrainPlanDetailSelectActivity" android:theme="@style/train_center_theme">
<intent-filter>
<action android:name="com.huami.watch.train.ui.activity.TrainPlanDetailSelectActivity"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:name=".ui.activity.TrainRecordDetailActivity">
<intent-filter>
<action android:name="com.huami.watch.train.ui.activity.TrainRecordDetailActivity"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:name=".ui.activity.TrainWeeklyRecordDetailActivity"/>
<activity android:name=".ui.activity.TrainWidgetRemindActivity"/>
<service android:name=".ui.notification.NotificationService"/>
<receiver android:name=".ui.notification.NotificationReceiver">
<intent-filter>
<action android:name="com.huami.watch.train.broadcast.daytrainrecord"/>
</intent-filter>
<intent-filter>
<action android:name="com.huami.watch.train.broadcast.finishtrainrecord"/>
</intent-filter>
<intent-filter>
<action android:name="com.huami.watch.train.broadcast.start_service"/>
</intent-filter>
<intent-filter>
<action android:name="com.huami.watch.train.broadcast.end_service"/>
</intent-filter>
<intent-filter>
<action android:name="com.huami.watch.train.broadcast.appstart"/>
</intent-filter>
</receiver>
<receiver android:enabled="true" android:exported="true" android:name=".ui.notification.CloudDataReceiver">
<intent-filter>
<action android:name="com.huami.watch.companion.action.DataSyncRequestApps"/>
</intent-filter>
</receiver>
<provider android:authorities="com.huami.watch.train.ui.provider.dayTrainRecordProvider" android:exported="true" android:name="com.huami.watch.train.ui.provider.DayTrainRecordProvider"/>
<activity android:name=".ui.activity.FinishTrainReasonActivity"/>
</application>
</manifest>
Still no luck.
Can anybody help?

If the data is stored in the watch only (and I think it's the case for Training app), it was wiped out when you unpaired, so there is no way to recover it.

lfom said:
If the data is stored in the watch only (and I think it's the case for Training app), it was wiped out when you unpaired, so there is no way to recover it.
Click to expand...
Click to collapse
Sure. That's understandable. Still, if I know exactly how is it stored - I could recreate it.
I saw a sqlite3 file in xbin folder. Problem is that it is encrypted and I cannot open it.
Does anyone have any idea how do those guys store data on such apps?

pkondrat said:
Sure. That's understandable. Still, if I know exactly how is it stored - I could recreate it.
I saw a sqlite3 file in xbin folder. Problem is that it is encrypted and I cannot open it.
Does anyone have any idea how do those guys store data on such apps?
Click to expand...
Click to collapse
Ah, I see what you want to do now. See my AmazeBackup tool, it backups and restores data to the Sports app, you can use adb to backup data from TrainingPlan app, extract its db, modify the file, add the modded file to backup manually, then try to restore the file to watch (restart watch after you restore to make sure it loads the new data).

lfom - thanks a lot for the tip.
I solved it.
Biggest challenge was to identify and get the access to /data/data/com.huami.watch.train/databases/train_center.db which hold all the data.
After that happended, it was just a try and check for different values in TrainRecord and DayTrainRecord DB tables + adb pull and adb push as a root.
Still, I wonder when they would add those training plans to Amazfit Watch app and synchronize this data properly.

Related

[Q] ADW Theme - Help...

Alright so to start off i have eclipse, the android sdk, and all that other good stuff setup properly.
Now the problem is i keep getting an error in the androidmanifest.xml saying
<uses-sdk android:minSdkVersion="4"/>
The error message when clicked upon is, <uses-sdk> tag appears after <application> tag.
I have tried multiple versions of the sdk build including 2.2 (as the guide suggest) and changing the minimum sdk requirement but i always seem to run into this exact same problem. Any ideas? Oh and also im using this template
AnderWeb-ADW.Theme-Template-d8491c4
Heres the entire AndroidManifest.xml...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="Red.Glow.Adw"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="internalOnly">
<application android:label="@string/theme_title" android:icon="@drawable/theme_icon">
<activity android:name=".main"
android:label="@string/theme_title">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="org.adw.launcher.THEMES" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="org.adw.launcher.icons.ACTION_PICK_ICON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="red.glow.adw.docks"
android:label="@string/theme_title"
android:icon="@drawable/theme_icon">
<intent-filter>
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
<provider android:name="red.glow.adw.docksProvider" android:authorities="red.glow.adw.docksProvider" />
</application>
<uses-sdk android:minSdkVersion="4"/>
</manifest>
Ehh figured it out.. AnderWeb's template build was throwing me up a ton of errors but kaydensigh's template works great.

[Q] fix force close on boot- need help

Ive gotten pretty far on my own launcher.I used this code to make it so when you click home your launcher appears:
<activity
android:label="@string/app_name"
android:name=".yourclassname.java" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
This works but when i reboot and click on my launcher it force closes. To fix this temporarily i just click on my app from a different launcher. Anyone have an idea on how to fix this? THANKS

Please Help, Settings crash I don't know why

Hi, earlier in my quest to create a Home Screen app, I have stumbled upon this code which was brilliant in order to let me do exactly what I wish to do. it couldn't work better than it does.
However ever since I included this when I run it on a tablet the following message appears "Settings have stopped working" the app continues functioning without any worries, however this is really bad because I don't want it to lhave these errors since I'm plannning on distributing the application....
<activity
android:name="com.myapp.launcher.MainActivity"
android:exported="true"
/>
<activity-alias
android:name="LauncherAlias1"
android:targetActivity="com.myapp.launcher.MainActivity"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name="LauncherAlias2"
android:enabled="false"
android:targetActivity="com.myapp.launcher.MainActivity"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>

How to mod any(?) app for multiwindow

While Wanam does a good job of allowing any app to float it does not allow the app to appear in the multiwindow tool bar (at least for me) and the side by side view that is native to the feature is what I am after.
You will need to know what decompiling an apk means and probably a non android device. Haven't tried on-board apk decompilers since they are lame.
So just as a synopsis of info easily found anyway here is my method -
Copy the app from /data/app/whatever. This will be called base.apk for all non-system apps. I rename it to something sane for the next step, helpful if doing several at a time.
Copy/move to PC
Using your preferred apk decompiler extract the apk. Open AndroidManifest.xml and within the <application> tag add the following:
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow"> </uses-library>
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:value="598.0dip" />
Then in the main intent filter add
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
So the xml will look similar to this
<application android:icon="@drawable/icon" android:label="@string/app_name" .... OMITTED>
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow"> </uses-library>
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:value="598.0dip" />
.... OMITTED
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
.... OMITTED
</application>
Re-compile, rename to base.apk, replace source base.apk in /data/app/whatever/ with modded version, set permissions (solid explorer does this automagically), reboot.
The app can now be added to the multiwindow bar and used to create a side by side view with other multiwindow aware apps. I've done around 10, Sygic is the only one that won't recompile due to its own issues
For me it is useful to have browser/dictionary, file explorer/text editor and other pairs predefined in the multi window panel.

Show Dialer(InCall) App In recent App

I'm Working On A Special Custom Rom I actually Complete This Rom But I Want To show Dialer App During the call (InCall) In Recent Call , But Unfortunately this App Is Not Shown In recent By default and i need to show that, So What Can I Do ?
this is manifest dialer -i9300-cm12.1
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:sharedUserId="com.android.dialer" coreApp="true" package="com.android.dialer" platformBuildVersionCode="22" platformBuildVersionName="5.1.1-47df0fc0f9">
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.CALL_PRIVILEGED"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.READ_CALL_LOG"/>
<uses-permission android:name="android.permission.WRITE_CALL_LOG"/>
<uses-permission android:name="android.permission.READ_PROFILE"/>
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS"/>
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
<uses-permission android:name="android.permission.NFC"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
<uses-permission android:name="android.permission.CONTROL_INCALL_EXPERIENCE"/>
<uses-permission android:name="com.android.voicemail.permission.ADD_VOICEMAIL"/>
<uses-permission android:name="com.android.voicemail.permission.WRITE_VOICEMAIL"/>
<uses-permission android:name="com.android.voicemail.permission.READ_VOICEMAIL"/>
<uses-permission android:name="android.permission.ALLOW_ANY_CODEC_FOR_PLAYBACK"/>
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
<uses-permission android:name="android.permission.READ_PHONE_BLACKLIST"/>
<uses-permission android:name="android.permission.CHANGE_PHONE_BLACKLIST"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.BROADCAST_STICKY"/>
<uses-permission android:name="android.permission.STOP_APP_SWITCHES"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="com.qualcomm.permission.USE_PHONE_SERVICE"/>
<application android:backupAgent="com.android.dialer.DialerBackupAgent" android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher_phone" android:label="@string/applicationLabel" android:name="DialerApplication" android:supportsRtl="true">
<meta-data android:name="com.google.android.backup.api_key" android:value="AEdPqrEAAAAIBXgtCEKQ6W0PXVnW-ZVia2KmlV2AxsTw3GjAeQ"/>
<uses-library android:name="com.qualcomm.qti.smartsearch"/>
<activity android:clearTaskOnLaunch="true" android:enabled="@android:bool/config_voice_capable" android:icon="@mipmap/ic_launcher_phone" android:label="@string/launcherActivityLabel" android:launchMode="singleTask" android:name=".DialtactsActivity" android:theme="@style/DialtactsActivityTheme" android:windowSoftInputMode="adjustNothing|stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.DIAL"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:mimeType="vnd.android.cursor.item/phone"/>
<data android:mimeType="vnd.android.cursor.item/person"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.DIAL"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="voicemail"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.DIAL"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.DIAL"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="tel"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.CALL_BUTTON"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
<intent-filter>
<action android:name="com.android.phone.action.TOUCH_DIALER"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.TAB"/>
</intent-filter>
<intent-filter android:label="@string/recentCallsIconLabel">
<action android:name="com.android.phone.action.RECENT_CALLS"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.TAB"/>
</intent-filter>
<meta-data android:name="com.android.keyguard.layout" android:resource="@layout/keyguard_preview"/>
</activity>
<activity android:exported="false" android:label="@string/dialer_settings_label" android:name="com.android.dialer.settings.DialerSettingsActivity" androidarentActivityName="com.android.dialer.DialtactsActivity" android:theme="@style/SettingsStyle"/>
<activity android:icon="@mipmap/ic_launcher_phone" android:label="@string/call_log_activity_title" android:name="com.android.dialer.calllog.CallLogActivity" android:screenOrientation="nosensor" android:theme="@style/DialtactsThemeWithoutActionBar">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:mimeType="vnd.android.cursor.dir/calls"/>
</intent-filter>
</activity>
<activity android:icon="@mipmap/ic_launcher_phone" android:label="@string/callDetailTitle" android:name="com.android.dialer.CallDetailActivity" androidarentActivityName="com.android.dialer.calllog.CallLogActivity" android:theme="@style/CallDetailActivityTheme">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="vnd.android.cursor.item/calls"/>
</intent-filter>
</activity>
<activity android:icon="@mipmap/ic_launcher_phone" android:label="@string/callStatsDetailTitle" android:name=".callstats.CallStatsDetailActivity" android:screenOrientation="portrait" android:theme="@style/CallDetailActivityTheme">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:name="com.android.contacts.common.test.FragmentTestActivity">
<intent-filter>
<category android:name="android.intent.category.TEST"/>
</intent-filter>
</activity>
<activity-alias android:exported="true" android:name="DialtactsActivity" android:targetActivity=".DialtactsActivity"/>
<activity-alias android:exported="true" android:name="RecentCallsListActivity" android:targetActivity=".DialtactsActivity"/>
<activity-alias android:exported="true" android:name=".activities.CallLogActivity" android:targetActivity=".DialtactsActivity"/>
<activity android:label="@string/activity_title_contacts_filter" android:name="com.android.contacts.common.list.AccountFilterActivity" android:theme="@style/ContactListFilterTheme"/>
<activity android:label="@string/custom_list_filter" android:name="com.android.contacts.common.list.CustomContactListFilterActivity" android:theme="@style/ContactListFilterTheme"/>
<activity android:configChanges="keyboardHidden|orientation|screenSize" android:name="com.android.contacts.common.vcard.ImportVCardActivity" android:theme="@style/BackgroundOnlyTheme"/>
<activity android:configChanges="keyboardHidden|orientation|screenSize" android:name="com.android.contacts.common.vcard.NfcImportVCardActivity" android:theme="@style/BackgroundOnlyTheme"/>
<activity android:name="com.android.contacts.common.vcard.CancelActivity" android:theme="@style/BackgroundOnlyTheme"/>
<activity android:name="com.android.contacts.common.vcard.SelectAccountActivity" android:theme="@style/BackgroundOnlyTheme"/>
<activity android:name="com.android.contacts.common.vcard.ExportVCardActivity" android:theme="@style/BackgroundOnlyTheme"/>
<service android:exported="false" android:name="com.android.contacts.common.vcard.VCardService"/>
<receiver android:enabled="@android:bool/config_voice_capable" android:name=".calllog.CallLogReceiver">
<intent-filter>
<action android:name="android.intent.action.NEW_VOICEMAIL"/>
<data android:host="com.android.voicemail" android:mimeType="vnd.android.cursor.item/voicemail" android:scheme="content"/>
</intent-filter>
<intent-filter androidriority="100">
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<activity android:label="@string/speed_dial_settings" android:name=".SpeedDialListActivity" android:theme="@style/DialtactsTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
<receiver android:name=".interactions.UndemoteOutgoingCallReceiver">
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL"/>
</intent-filter>
</receiver>
<service android:exported="false" android:name=".calllog.CallLogNotificationsService"/>
<service android:exported="false" android:name=".contact.ContactUpdateService"/>
<receiver android:name="com.android.contacts.common.location.CountryDetector$LocationChangedReceiver"/>
<service android:exported="false" android:name="com.android.contacts.common.location.UpdateCountryService"/>
<activity android:configChanges="keyboardHidden" android:excludeFromRecents="true" android:exported="false" android:label="@string/phoneAppLabel" android:launchMode="singleInstance" android:name="com.android.incallui.InCallActivity" android:screenOrientation="nosensor" android:theme="@style/Theme.InCallScreen"/>
<service android:name="com.android.services.callrecorder.CallRecorderService" androidrocess="com.android.incallui"/>
<activity android:configChanges="keyboardHidden|orientation" android:excludeFromRecents="true" android:exported="false" android:launchMode="singleInstance" android:name="com.android.incallui.CircularRevealActivity" android:noHistory="true" android:screenOrientation="nosensor" android:theme="@style/Theme.CircularRevealAnimation"/>
<receiver android:exported="false" android:name="com.android.incallui.InCallApp$NotificationBroadcastReceiver">
<intent-filter>
<action android:name="com.android.incallui.ACTION_HANG_UP_ONGOING_CALL"/>
</intent-filter>
</receiver>
<service android:name="com.android.incallui.InCallServiceImpl" androidermission="android.permission.BIND_INCALL_SERVICE">
<intent-filter>
<action android:name="android.telecom.InCallService"/>
</intent-filter>
</service>
<provider android:authorities="com.android.dialer.provider" android:exported="false" android:multiprocess="false" android:name="com.android.dialer.lookup.LookupProvider"/>
</application>
</manifest>
Omg.. plss use spoiler or code next time

Categories

Resources