[Tutorial]How to use Timer Function - C++ or Other Android Development Languages

You may need a timer......for what????
okay....in this guide i'm showing you to how to switch to the next layout maybe.....
This is not originally a my code.....Just sharing with you
Read Carefully and Realize
1- Start your mono android project
2- Go to your activity, add the following
Code:
using System.Timers;
//This is how my code looked like after adding it,
Code:
[FONT="Arial Black"][B]using System;
using System.Timers;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace Timer
{
[Activity(Label = "Timer", MainLauncher = true, Icon = "@drawable/icon")]
public class Activity1 : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
}
}
}[/B][/FONT]
3- Now create a another layout
Resources---Layout----Right Click---Add New Item
Choose Android Layout
Name the layout whatever you want. (I named it to Main2)
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
4- Within the brackets after Public Class, add below,
Code:
int count = 1;
System.Timers.Timer timer1;
//for the the timer1, you can replace anything you want to refer your timer
5- After this code ,
Code:
SetContentView(Resource.Layout.Main);
Type this,
Code:
timer1 = new System.Timers.Timer(200);
timer1.Interval = 100;
timer1.Elapsed += new ElapsedEventHandler(OnTimeEvent);
timer1.Enabled = true;
timer1.Start();
6- Now after the code below,
Code:
int count = 1;
System.Timers.Timer t1;
type this,
Code:
private void OnTimeEvent(object source, ElapsedEventArgs e)
{
RunOnUiThread(delegate
{
count++;
if (count == 200)
{
SetContentView(Resource.Layout.Main2);
timer1.Enabled = false;
}
});
}
this code is running in background to whether check if the timer reached to 200 or not, when it reached, then the Main2 layout will load and timer will be disabled.
7- All done now, run it on AVD or your phone. :laugh::laugh::laugh::laugh:
Happy CODING!

Be Creative, be kind, share what you have got

Alternative
If you just wanna go.from one.class to another after a certain amount of time(This is your purpose, i believe). Then instead of.writing such a huge amount of code. You can just make it sleep for 200 millisecond and start an intent.
Like
Code:
sleep(200);
Intent a= new Intent(existing class.this, thenextclass.class);
startActivity(a);
Also if you want you can surround it with a try and catch method.
I think this will do.
And its a class i.e a .java file. Not a layout.
A layout is your .xml file..

I think the point of using a timer was so that program execution wasn't halted and other things would/could continue. If you use sleep then it blocks the thread and no further execution takes place till it continues
Just out of curiosity, ScatteredHell, why would you not just set the interval to 20,000 (20 seconds)? I don't see any benefit to the counter method you've used.

That is the point you see...
You should add all the codes before your timer thread.
then,
Code:
try{sleep(200)}
catch(InterruptedException a){
a.printStackTrace()}
finally{
your intent
}
surrounded by a thread ofcourse
Sent from my GT-S6102 using xda app-developers app

@hiphop
you saying in JAVA, maybe there are few other ways to do that. Man in XAMARIN android layout is not a xml file.....use this before talking
layout is .axml and activity is .cs
this is for C# man
@Archer
I didn't have any purpose, I only wanted to tell this to starters....So that's
Users must be creative to use this

As far as i know.
xamarin is for ios.
(correct me, if i am wrong)..
And sorry, i forgot that you were talking about c#
Sent from my GT-S6102 using xda app-developers app

hiphop12ism said:
That is the point you see...
You should add all the codes before your timer thread.
then,
Code:
try{sleep(200)}
catch(InterruptedException a){
a.printStackTrace()}
finally{
your intent
}
surrounded by a thread ofcourse
Sent from my GT-S6102 using xda app-developers app
Click to expand...
Click to collapse
You should definitely use a timer to wait, not sleep. If you use sleep then it will block the thread it's in, unless you put it in a separate thread and have a callback function for when it's complete. That's exactly the point of using a timer. You create the timer and assign a callback function to execute once the timer triggers. The UI will continue to work during that time. No separate thread needed.

hiphop12ism said:
As far as i know.
xamarin is for ios.
(correct me, if i am wrong)..
And sorry, i forgot that you were talking about c#
Sent from my GT-S6102 using xda app-developers app
Click to expand...
Click to collapse
U wrong man
, It's for iOS and Android both

t1
Hello.
Where did you use the t1 again, or the count in the OnCreate Bundle?
I want to use the timer to fil a progressbar, but I don't know where should I declare the variables.
Like this:
HTML:
ProgressBar progBar = FindViewById<ProgressBar> (Resource.Id.progressBar1);
P.S. :
Ohh and I forgot to mention that, but my application is closing after I launch it.

CCM_Creater said:
Hello.
Where did you use the t1 again, or the count in the OnCreate Bundle?
I want to use the timer to fil a progressbar, but I don't know where should I declare the variables.
Like this:
HTML:
ProgressBar progBar = FindViewById<ProgressBar> (Resource.Id.progressBar1);
P.S. :
Ohh and I forgot to mention that, but my application is closing after I launch it.
Click to expand...
Click to collapse
Sorry for the late reply. I use count inside of Activity 1 otherwise you cannot use it if you declared it in OnCreateBundle. I didn't play with xamarin in a long time, so sorry I don't remember. But i'm pretty sure you can find it in examples.
Go to project properties. There are 2 options. I exactly don't remember their title, when you tick those two options. app will run without the need of xamarin runtime on your phone. When you normally debug the app, runtime is automatically installed in your device, so it won't take long to debug as only app contain the code.

Related

[MOD][XPOSED][4.0+] CpuTemp in Statusbar

This little module allows you to show the CPU temperature in the statusbar.
Features:
- show temperature left or right (default is left)
- set update interval (default is 1000ms=1s)
- update interval will be stopped when screen is turned off to safe battery
If it doesn't work on your device then the temperature is stored in a different file.
Please contact me in this case and I'll fix it for you.
Sourcecode: https://github.com/M1cha/android_app_cputempinstatusbar
Download: http://repo.xposed.info/module/info.mzimmermann.xposed.cputempstatusbar
First of all great idea, but it didn't work for me.
Sent from SGSII
Plus GT-9105p
Stock on 4.2.2 JellyBean
Rooted ofc
And supercharged!!! ^_^
I had wanted to add this to one of my apps (Informer) but TBH I didn't know where to start! it's not working though, I've just two options Update Interval / Postion and no noti started
I've got galaxy nexus 4.3 ...... can't remember for the life of me what Rom...
I've updated to v1.1 which adds more support.I hope, that it now will work for all of you. If the temperatur will be too high(i.e. 340 instead of 34) tell me and I'll add a division by 10 for your device.
Just installed and still nothing.... no error or anything
Can you check if one of these path's exists and is readable on your device?https://github.com/M1cha/android_ap...ann/xposed/cputempstatusbar/CpuTemp.java#L123
Also check for a Warning from my app in logcat.
File f = new File("/sys/devices/platform/omap/omap_temp_sensor.0/temperature"); // got this
if(!f.exists()) {
f = new File("/sys/kernel/debug/tegra_thermal/temp_tj"); // no
mode = 0;
}
if(!f.exists()) {
f = new File("/sys/devices/system/cpu/cpu0/cpufreq/cpu_temp"); // no
mode = 0;
}
if(!f.exists()) {
f = new File("/sys/class/thermal/thermal_zone0/temp"); // no
mode = 0;
}
if(!f.exists()) {
f = new File("/sys/class/thermal/thermal_zone1/temp"); // no
mode = 0;
}
if(!f.exists()) {
f = new File("/sys/devices/platform/s5p-tmu/curr_temp"); // no
mode = 1;
}
what are the permissions of this file? it must be readable for the system user.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Can you make on the edge of the screen ? It's really on the center of the screen. And plausibility of the colour set will be perfect ?
Wysłane z mojego HTC One przy użyciu Tapatalka
ghul21 said:
Can you make on the edge of the screen ? It's really on the center of the screen. And plausibility of the colour set will be perfect ?
Wysłane z mojego HTC One przy użyciu Tapatalka
Click to expand...
Click to collapse
Do you mean the absolute left side? The Option Left/Right means if the icon is inserted as first or last icon in the icon-tray
m11kkaa said:
Do you mean the absolute left side? The Option Left/Right means if the icon is inserted as first or last icon in the icon-tray
Click to expand...
Click to collapse
Yup it will be perfect ?
Edit
One more thing, is it possible to add current cpu frequency or its it to much ?
Wysłane z mojego HTC One przy użyciu Tapatalka
updated to 1.1.1. I hope that everything works because I can't test everything(text color, because I can run AOSP/CM roms only)
Very good idea for XPosed but its not work in my phone, i have a GaLaxy 3 Mini with the XXAMG1 ROM rooted.
Thanks for porting this on my phone
Rom0307 said:
Very good idea for XPosed but its not work in my phone, i have a GaLaxy 3 Mini with the XXAMG1 ROM rooted.
Thanks for porting this on my phone
Click to expand...
Click to collapse
I think Trickster doesn't show the temperature for you, too then?
Can you try to execute this command via adb shell or terminal emulator and post the output?
Code:
find /sys -name *temp*
m11kkaa said:
I think Trickster doesn't show the temperature for you, too then?
Can you try to execute this command via adb shell or terminal emulator and post the output?
Code:
find /sys -name *temp*
Click to expand...
Click to collapse
well, everything is ok on my SGS2 running SuperNexus 4.2.2. milestone. Did you guys remember to reboot your phone? :S
m11kkaa said:
I think Trickster doesn't show the temperature for you, too then?
Can you try to execute this command via adb shell or terminal emulator and post the output?
Code:
find /sys -name *temp*
Click to expand...
Click to collapse
Thanks for reply
My screenshoots:
imageshack.us/a/img837/5917/6511.png
and
imageshack.us/a/img543/1964/ia5l.png
If you want more informations or screenshoots, speack me i will make it
Rom0307 said:
Thanks for reply
My screenshoots:
imageshack.us/a/img837/5917/6511.png
and
imageshack.us/a/img543/1964/ia5l.png
If you want more informations or screenshoots, speack me i will make it
Click to expand...
Click to collapse
Looks like old find command
try this:
busybox find /sys -name *temp*
If busybox is not found just install it from market.
m11kkaa said:
Looks like old find command
try this:
busybox find /sys -name *temp*
If busybox is not found just install it from market.
Click to expand...
Click to collapse
Ok, watch the screen
img842.imageshack.us/img842/2413/k0ce.png
Thanks man
Rom0307 said:
Ok, watch the screen
img842.imageshack.us/img842/2413/k0ce.png
Thanks man
Click to expand...
Click to collapse
mh I don't know if one of those is from the cpu. maybe your cpu doesn't have temperature sensor.
But many battery temp sensors
You could try to open the files to check if there are realistic temperatures stores anywhere.
m11kkaa said:
mh I don't know if one of those is from the cpu. maybe your cpu doesn't have temperature sensor.
But many battery temp sensors
You could try to open the files to check if there are realistic temperatures stores anywhere.
Click to expand...
Click to collapse
Okay, thank you anyway
If later you have another idea I said

[KERNEL][STOCK][4.4.2] Only Adb Insecure

[KERNEL][STOCK][4.4.2] Only Adb Insecure
Hi there!
I needed adbd to always run as root in order to push/pull files, but I wanted to stick as close as possible to stock, so I just modified the production boot.img with a patched version of adbd that enforces it to always run as root. I used a boot.img for Android 4.4.2 extracted from the factory images [1] provided by Google.
I thought that it could be usefull to somebody else so... here you have.
It comes in two flavors:
CWM installable .zip [2]
boot.img for fastboot[/URL] [3]
LINKS
[1] Google Factory Images : https://developers.google.com/android/nexus/images?hl=es#hammerhead
[2] CWM Installable .zip : https://mega.co.nz/#!lJVxWCaA!QA4Zo04_bnzxEjmHDyjUDl9cFiAjJ5QCuIzuYFN bnFU
[3] boot.img : https://mega.co.nz/#!sYE0xDZL!PpR1GzIraGCMxr9BOqrZ0wFbBnJO6HSdsee4mGF d5PA
Enjoy!!
XDA:DevDB Information
[KERNEL][STOCK][4.4.2] Only Adb Insecure, a Kernel for the Google Nexus 5
Contributors
_AtilA_
Kernel Special Features: Stock kernel, but with adbd running always as root, so you can adb push/pull/remount/shell/etc as root
Version Information
Status: Stable
Created 2014-01-16
Last Updated 2014-01-16
Err would be nice if we could auto patch a boot.img from other custom kernels ^^
BRiANj64 said:
Err would be nice if we could auto patch a boot.img from other custom kernels ^^
Click to expand...
Click to collapse
Not really sure about what you mean... Basically, the only change I made is a patched adbd. So, the only thing that other custom kernels have to do, is replace the binary. I can provide you a link with the binary, but it's quite easy to extract it from the boot.img
I you want to know exactly what I've changed in the adb.c, here it is:
Code:
static int should_drop_privileges() {
#ifndef ALLOW_ADBD_ROOT
return 1;
#else /* ALLOW_ADBD_ROOT */
int secure = 0;
char value[PROPERTY_VALUE_MAX];
/* run adbd in secure mode if ro.secure is set and
** we are not in the emulator
*/
#if 0 /* <JGM> No privileges drop! */
property_get("ro.kernel.qemu", value, "");
if (strcmp(value, "1") != 0) {
property_get("ro.secure", value, "1");
if (strcmp(value, "1") == 0) {
// don't run as root if ro.secure is set...
secure = 1;
// ... except we allow running as root in userdebug builds if the
// service.adb.root property has been set by the "adb root" command
property_get("ro.debuggable", value, "");
if (strcmp(value, "1") == 0) {
property_get("service.adb.root", value, "");
if (strcmp(value, "1") == 0) {
secure = 0;
}
}
}
}
#endif
return secure;
#endif /* ALLOW_ADBD_ROOT */
}
Simple, disable privilege drop logic and return the correct value.
can we flash using twrp recovery?? i think most people use twrp
P.Mobile said:
can we flash using twrp recovery?? i think most people use twrp
Click to expand...
Click to collapse
I don't really know! I've never used TWRP, maybe someone could tell us if CWM .zip file is compatible with the TWRP installation system
_AtilA_ said:
I don't really know! I've never used TWRP, maybe someone could tell us if CWM .zip file is compatible with the TWRP installation system
Click to expand...
Click to collapse
Yup
Sent from my Nexus 5 using Tapatalk
---------- Post added at 11:16 PM ---------- Previous post was at 11:14 PM ----------
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Can't imagine why all the guys are using custom kernels...:what:
Sent from my Nexus 5 using Tapatalk
_AtilA_ said:
Hi there!
I needed adbd to always run as root in order to push/pull files, but I wanted to stick as close as possible to stock, so I just modified the production boot.img with a patched version of adbd that enforces it to always run as root. I used a boot.img for Android 4.4.2 extracted from the factory images [1] provided by Google.
I thought that it could be usefull to somebody else so... here you have.
It comes in two flavors:
CWM installable .zip [2]
boot.img for fastboot[/URL] [3]
LINKS
[1] Google Factory Images : https://developers.google.com/android/nexus/images?hl=es#hammerhead
[2] CWM Installable .zip : https://mega.co.nz/#!lJVxWCaA!QA4Zo04_bnzxEjmHDyjUDl9cFiAjJ5QCuIzuYFN bnFU
[3] boot.img : https://mega.co.nz/#!sYE0xDZL!PpR1GzIraGCMxr9BOqrZ0wFbBnJO6HSdsee4mGF d5PA
Enjoy!!
XDA:DevDB Information
[KERNEL][STOCK][4.4.2] Only Adb Insecure, a Kernel for the Google Nexus 5
Contributors
_AtilA_
Kernel Special Features: Stock kernel, but with adbd running always as root, so you can adb push/pull/remount/shell/etc as root
Version Information
Status: Stable
Created 2014-01-16
Last Updated 2014-01-16
Click to expand...
Click to collapse
FWIW: The MEGA link does not work natively with the MEGA App if you attempt to download directly from your N5. The link is
Code:
https://mega.co.nz/#!lJVxWCaA!QA4Zo04_bnzxEjmHDyjUDl9cFiAjJ5QCuIzuYFNbnFU
_AtilA_ said:
I thought that it could be usefull to somebody else so... here you have.
Click to expand...
Click to collapse
This insecure boot works good for stock 4.4.3.
remount... delele... etc... by adb.
Thank you.

Convert from "S Health" to GPX (v1.1 2015.10.16)

Hi!
1) Pull from phone file /opt/usr/apps/com.samsung.shealth/data/.shealth.db
2) Open this file in SQLiteStudio
3) Open editor (Alt+E)
4) Add in editor the following:
Code:
select exerciseId, datetime(substr(startTimeStamp,1,10), 'unixepoch') as startTime from shealth_exercise_history order by startTimeStamp;
Select all (Crtl+A) and execute (F9).
You'll see all your trainings. Remember the value "exerciseId" of the desired training. For example "5".
5) Replace the contents of the editor by doing the following:
Code:
select '<?xml version="1.0" encoding="UTF-8" standalone="no" ?><gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:gpxtrkx="http://www.garmin.com/xmlschemas/TrackStatsExtension/v1" xmlns:wptx1="http://www.garmin.com/xmlschemas/WaypointExtension/v1" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns:gpxpx="http://www.garmin.com/xmlschemas/PowerExtension/v1" creator="Samsung Gear S with Barometer" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www8.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackStatsExtension/v1 http://www8.garmin.com/xmlschemas/TrackStatsExtension.xsd http://www.garmin.com/xmlschemas/WaypointExtension/v1 http://www8.garmin.com/xmlschemas/WaypointExtensionv1.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd http://www.garmin.com/xmlschemas/PowerExtension/v1 http://www.garmin.com/xmlschemas/PowerExtensionv1.xsd"><metadata><link href="http://www.index3.ru"><text>iNDEX3</text></link><time>'||strftime('%Y-%m-%dT%H:%M:%SZ', datetime(substr(gh.startTimeStamp,1,10), 'unixepoch'))||'</time></metadata><trk><name>'||datetime(substr(gh.startTimeStamp,1,10), 'unixepoch')||' Auto</name><extensions><gpxx:TrackExtension><gpxx:DisplayColor>Cyan</gpxx:DisplayColor></gpxx:TrackExtension></extensions><trkseg>' as gps
from shealth_exercise_history gh where gh.exerciseId=XX
union all
select
'<trkpt lat="'||g.latitude||'" lon="'||g.longitude||'"><ele>'||g.altitude||'</ele><time>'||strftime('%Y-%m-%dT%H:%M:%SZ', datetime(substr(g.timeStamp,1,10), 'unixepoch'))||'</time><extensions><gpxtpx:TrackPointExtension><gpxtpx:hr>'||h.heartrate||'</gpxtpx:hr></gpxtpx:TrackPointExtension></extensions></trkpt>' as gpx
from shealth_exercise_gps_info g
left join (
select gt.timeStamp as g_timeStamp
, (select max(ht.timeStamp) from shealth_exercise_hrm_logging ht where ht.timeStamp<=gt.timeStamp and ht.exerciseId=gt.exerciseId) as h_timeStamp
, gt.exerciseId
from shealth_exercise_gps_info gt
) tsm on tsm.g_timeStamp=g.timeStamp and tsm.exerciseId=g.exerciseId
left join shealth_exercise_hrm_logging h on h.timeStamp=tsm.h_timeStamp
where g.latitude <> 200 and g.exerciseId=XX
union all
select '</trkseg></trk></gpx>';
Find in text "exerciseId=XX" and replace to value ("XX") to the value of your exerciseId ("5").
Select all (Crtl+A) and execute (F9).
6) Save result in txt file with extension ".gpx".
Enjoy
I have collected all scripts into one package:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
1) Unzip and run "0.start.bat"
2) Enjoy x2
Update:
v1.1 Added option "Save all trainings"
[DOWNLOAD v1.1]
iNDEX3 said:
Hi!
1) Pull from phone file /opt/usr/apps/com.samsung.shealth/data/.shealth.db
2) Open this file in SQLiteStudio
3) Open editor (Alt+E)
4) Add in editor the following:
Code:
select exerciseId, datetime(substr(startTimeStamp,1,10), 'unixepoch') as startTime from shealth_exercise_history order by startTimeStamp;
....
Click to expand...
Click to collapse
Dear iNDEX3,
Would you mind explaining what GPX does, what are the benefits in comparing with S Health...etc.
--------------
PS: I'm a huge fan of 4pda.ru, although I know just a little Russian (enough to read the captcha when login, lol). I see that you guys have this cool tool called 'RogersTools' - allowing us to backup Gear S, but I don't understand it well (due to my limited understanding of Russian).
Would you guys mind sharing this awesome tools to us here at XDA? :good::good::good:
This is very interesting. Thanks for sharing.
hadobac said:
Would you mind explaining what GPX does, what are the benefits in comparing with S
Click to expand...
Click to collapse
For example, I load my tracks in strava. This is the first time.
hadobac said:
Would you guys mind sharing this awesome tools to us here at XDA?
Click to expand...
Click to collapse
I conveyed the request of the developer RogersTool
iNDEX3 said:
I conveyed the request of the developer RogersTool
Click to expand...
Click to collapse
Thanks bro. Way to go!
Also, is running this tool here as easy as ClockWorkMod, or TitaniumBackup?
hadobac said:
Also, is running this tool here as easy as ClockWorkMod, or TitaniumBackup?
Click to expand...
Click to collapse
Yes, it is very easy to use and reliable application. All actions are done in one click.
It pull .shealth.db file from the phone.
Instead, you can use commands SDB (Smart Development Bridge):
Code:
>sdb root on
>sdb pull /opt/usr/apps/com.samsung.shealth/data/.shealth.db
iNDEX3 said:
Yes, it is very easy to use and reliable application. All actions are done in one click.
It pull .shealth.db file from the phone.
Click to expand...
Click to collapse
The question was about the BACKUP, RESTORE (not only) for smart HOURS SAMSUNG GEAR S WITH ROOT FIRMWARE.
Shum Channel said:
The question was about the BACKUP, RESTORE (not only) for smart HOURS SAMSUNG GEAR S WITH ROOT FIRMWARE.
Click to expand...
Click to collapse
I did not understand the question
But I use this utility for backup. And it's brilliant!
Add package in the first post
how to use the script
Hi,
is there any way to get .shealth.db from the phone? I don't want to root the watch.
Sorry, i don't know how to get .shealth.db from the phone without root
.shealth.db file
Hello,
I have rooted note2 phone with root explorer, but cannot find .shealth.db file.
There is no directory: /opt/usr/apps/com.samsung.shealth/data/.shealth.db
I found /Android/data/com.sec.android.app.shealth/files but there is no database file.
Where can I find it on Kitkat 4.4.2?

Why Should We Use the App Bundle? Release App Bundle on AppGallery

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
When we want to release Android projects, there are two distribution options.
generate app bundle or generate signed apk.
Although it is the app bundle that comes selected, most of us have to make an extra click and use the first usual method the generate signed apk. This method may seem more reasonable to share the app with a small pool of users without distributing it to any store.
But if your application appeals to large audiences in the store, using app bundle becomes more and more inevitable. So what is the app bundle and what is the difference?
Let’s take a look at these now
Faster installation, Less disk space!
APP Bundle
The apk file contains all the files and codes of the project. It has a certificate stating that it is signed. If we are distributing to the market with the .apk file, this certificate is very critical. This certificate must be retained for implementation purposes (eg update).
An apk file collects the project’s available resources (audio, video, photo, mandatory data) in one package. It does not accommodate Dynamic Features or Assets device group specific.
Reduced APK Size
When you publish your applications using application packages, you can reduce the size of your application, simplify versions, and enable advanced distribution features.
Application packages use a publishing model called Dynamic Delivery to create and publish APKs optimized for each device configuration.
Thus, it offers users more efficient applications.
This way, you only need to create, sign and upload a single build to support APKs optimized for a wide variety of device configurations.
So, can we use the app bundle on AppGallery?
Yes, you can distribute your application with the app bundle in the AppGallery, and you can move your existing apk to the app bundle.
Let’s see how to do this.
Publishing App Bundle in AppGallery
To release our project as app bundle on AppGallery, we must first create the app signing file on the AppGallery console.
AppGallery Connect provides you with two signature creation methods:
1. Let AppGallery Connect to create and manage my app signature key (recommended);
2. Export and upload the key and certificate. The first one is recommended. If it is unavailable, use the second method. Note that,
usepepk.jarfound over the Internet instead offrom Android Studio to export and upload the key and certificate.
In this article, I will add an app signing file using the method suggested in the first item.
If you want to add as in the 2nd way, I recommend you to read the following article
https://medium.com/huawei-developers/guide-of-create-app-signature-file-c3bcb1f3b5bd
For generate signed bundle continue
If you already have a keystore file you can continue with that. If you don’t have you should create a new
Choose your variant and generate your signed bundle
After generating the signed app bundle, we click on 1 to access the aab file, and 2 to access the exported key file. Click on the area specified in 2 and go to the file location where our private key was created. Open power shell in here and run the command below.
Code:
$ keytool -export -rfc -keystore upload-keystore.jks -alias upload -file upload_certificate.pem
Notarameters must be replaced as needed.
Click on browse and add the upload certificate and click to submit button.
Our application signature certificate is ready now, we can go to version control and add our app bundle and release it. If the signature key uploaded to AppGallery Connect is different from that of the released app, the new certificate fingerprint may be different from that generated locally during app development. If the services you are integrating need to depend on the SHA-256 certificate fingerprint, you need to add the new SHA-256 certificate fingerprint for your app.
For the release our bundle go to version information section
And add your generated signed . aab file to here. To find the bundle file, you can click the link indicated with 1 above and access the .aab file.
Final
Now you can publish your application as an app bundle. In this way, you can reduce the update sizes of your existing applications and provide a better experience to the end user.
It is very tempting for developers to repeatedly delete and install the entire package after each development.
I hope this article will be useful to developers who want to use app bundle and want to publish their app as app bundle in AppGallery.
Thank you for reading!
Resources
https://developer.huawei.com/consum...pGallery-connect-Guides/agc-appsigning-newapp
https://developer.huawei.com/consumer/en/doc/distribution/app/18527283
How do I change the signature key or upload key managed in AppGallery Connect?
Interesting method.

Huawei Ability Gallery Content Ability

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Hello everyone, In this article, we will be exploring how to develop content ability . Also I will share an example We developed before.
Note I: If you want to develop any ability, you need to have an enterprise account otherwise You can reach relevant panel on Huawei console.
Note II: Everyone in team account can’t use same enterprise account to develop ability.
What is Content Ability ?
Content ability looks like card but There are a few differences between card ability and content ability. Following image shows us How it looks like. Main differences will be explained next steps.
​What are the differences between Content and Card Ability ?​Content Ability
Developers only provide an API which includes information about design and data which will be displayed on Content body. This API is used to be generated content view by HAG server.
Developers can’t design card template using HTML,CSS and JS for content ability because Content ability design information consists of JSON format. They just select an predefined design template and use it in API response message.
Developers should use schema definition provided by Huawei.
Nowadays HAG provides a few types of card templates but These are enough to meet for CP requirements.
Developers can deploy content ability in short time with only developing an API.
When Users click some thing on Content ability , They can be redirected to Native App, Quick App or Web Page using deeplink
Card Ability
For Card ability There many way to develop card. Developers can design as they wish or they can use predefined template Also They can modify predefined card template. I think that last option is good alternative for designing from beginning to end. Because Card ability has many design restrictions for much information you can visit following page: Link.
They can develop special card design using HTML,CSS and JS.
Developers have to use Huawei Quick App IDE to design card ability and They need to use a few application to display card ability. You can find all required app for Card and Quick App solution : Link.
Card abilities are developed using HTML,CSS and JavaScript so These platforms provide us many feature to use with Card ability.
Many of JavaScript features can be used with Quick App like Fetch API.
Developers can obtain data from server and show data on body of card.
When Users click some thing on Card ability , They can be redirected to Native App, Quick App or Web Page using deeplink.
Content Ability’s Working Principle​HUAWEI Ability Gallery gets service data from developers’ server and generates smart card to end users.
Users can reach content ability via touch points Which Huawei provides us. Nowadays There are 4 touch point AI Voice, AI Lens, AI Search, Smart Services.
After Users send intent using any one of touch point , HAG server gets following request and send data request to Developers’ server via API which was provided by developers to obtain content ability design. When HAG obtains response message from developers’ server with successfully, It generate a content and then present it to users with data.
Following image describes Working principle of Content Ability.
Let start to develop a content ability step by step​I will explain how to develop content ability using general content template but There are many content templates.
First of All we need to create an Ability and determine its category and then you should fill following page for Ability Basic information, Country/ Region and Display information.
Basic information page includes ability information.
Select release countries / regions. Select countries or regions where the ability is to be released.
Display information consist of ability display information like icon, name, description, etc.
After that We can set content ability design , service and API which was provided by developers to generate content .
I want to explain important sections of fulfillment page as shortly.
Type : describes ability type. There are three ability type Web Service, Custom Card and RPK/APK and H5 link. We need to select Web service type for content ability.
Distributable ability capabilities : Developers should select capabilities which will provide in Content ability. For example Content ability will include image and text on body, they need to select Provide texts and images option.
Personal data authorization: Section can provide us user specials information like user location, Voice texts or photos of a user.
Service Links : The links (required only for mobile phones/tablets) are configured for the Go to service function (tap the three-dot icon button on the top of the card and then tap Go to service), which are different from those to be redirected when a card is tapped.
Web service card instance: After a card instance is configured, it will be displayed as the GUI effect when the user triggers the service intent. HAG only supports API data source to generate content ability design.
Before develop API, Developers need to prepare Content ability design template using this template. After click set button, content ability’s design page will be opened and developers can choose best design option for their project.
General Templates shows that Content ability predefined templates. Developers just select one of the template from there.
Attribute Panel, After select a content template, Developers can change something on content ability body item like text, button, Image size from this section.
After any item’s modification is finished on content ability, JSON file is generated automatically. JSON file is important because Developers use it in response message of API so When design operation is finished, It should be saved and downloaded. Following image shows us content design as JSON format. This is called Schema Definition. You can visit following link for detail information : Link
Code:
{
"version": "1.0",
"errorCode": "",
"errorMessage": "",
"sessionAttributes": "",
"reply": {
"isEndSession": true,
"displayText": "",
"speech": {
"type": "",
"text": "",
"ssml": ""
},
"commands": [
{
"head": {
"name": "DisplayTemplate",
"namespace": "Render"
},
"body": {
"templateType": "BasicImageDetailTemplate",
"generalCardInstance": "contentAbilityDesign",
"templateContent": {
"items": {
"type": "BasicImageDetailTemplate",
"content": {
"primaryInfo": {
"primaryText": {
"text": "Product Name",
"highlightText": [
"",
""
],
"highlightColor": ""
}
},
"imageInfo": {
"imageInfoList": [
{
"scale": "OneToOne",
"url": "Image URL "
}
]
},
"detailUrl": {
"webURL": "",
"deepLink": {
"url": "",
"appPackage": "",
"minVersion": 1
},
"quickApp": {
"url": "",
"minPlatformVersion": 1,
"minVersion": 1
},
"silentLink": {
"url": "",
"appName": "",
"appPackage": "",
"appBrief": "",
"appIconUrl": "",
"channelPackageId": ""
}
},
"auxiliaryInfo": [
{
"auxiliaryText": [
{
"text": "Product Price",
"bulletsUrl": "",
"highlightColor": ""
}
]
}
]
}
},
"buttonLinkArray": [
{
"buttonText": "More Products",
"webURL": "",
"deepLink": {
"url": "",
"appPackage": "",
"minVersion": 1
},
"quickApp": {
"url": "",
"minPlatformVersion": 1,
"minVersion": 1
},
"silentLink": {
"url": "",
"appName": "",
"appPackage": "",
"appBrief": "",
"appIconUrl": "",
"channelPackageId": ""
}
}
]
}
}
}
]
}
}
In JSON file Template content section describe all item in content ability’s body. As you see our example consists of 2 texts, an image and a button. In addition You can set URL to redirect users to specific Native , Quick APP and Web page. If you want to redirect users to App, you should use deeplink. For Web page, You just need to write an URL of Web Page.
​After Download JSON file We can come back to fulfillment page.
Service Deployment : Developers set there with API which was developed before. You can find Backend code at the end of the page for our application.
Following Image figures out Request & Response message also It shows us how we can use content JSON in response message. As you know request and response messages have to be developed on Backend side. You can find example of it following lines.
Note : There are many Schema definitions for different category and develops have to follow their structure to generate content ability.
Intent Declaration for Content Ability​Intents of content abilities are classified into user intents, event intents, and resident intents. At least one of them must be configured.
User Intents : Goals or tasks that users want to achieve, such as taking a taxi and querying the weather. If your user’s intent matches the intent you configure here, HUAWEI Ability Gallery will provide the user with the required ability.
Event intents : Event notifications that you sent to HUAWEI Ability Gallery. When receiving an event, HUAWEI Ability Gallery checks whether the event matches that already configured.
Resident intents : Resident intent cards can be used only in HUAWEI Assistant TODAY. If you need a resident intent card, just create it, with no need to push events. The card will be always available in HUAWEI Assistant TODAY. It is able to redirect users to your ability or recommend content to users, such as popular recipes, Products and hotels.
How can we test Content Ability ?​Developed app can be tested with Huawei Ability test tool ,device test and Interface test options.
If Developers want to test content ability using Huawei Ability test tool, Firstly They need to download it from Huawei App Gallery then they need to generate QR code to test content ability. After generate QR code, Developers can scan it with Huawei Ability Test tool to check if it works or not.
​Also They can test content ability on Real device after create user test list in HAG test page. Following image shows us HAG Test page. Finally Users in the Real-Device Test List can see content on Huawei Assistant Page.
​If Developers don’t have Huawei Device to test, They can use Interface test section and select relevant intent type of content ability to see its view.
Note : Before the test, ensure that the configured intent has been associated with a fulfillment. Otherwise, the test cannot be performed.
​References​Enterprise Account Information : Link
Content Ability Configuration Web Page : Link
Content Ability Design Guide : Link
Fulfillment API :Link
Content Ability Schema Definitions for different Categories : Link
Content Ability Test Guide : Link

Categories

Resources