I would like to update the SmartWatch widget whenever the user changes the widget settings.
I know it can be done by sending an WIDGET_IMAGE_UPDATE_INTEN intent, but it seems that I don't have the information of host app package name (i.e. com.sonyericsson.extras.smartwatch).
How can I get "host app package name"?
PS: Currently, I've hardwired the "com.sonyericsson.extras.smartwatch" name in my code.
Every time your widget extension is receiving an intent from the host application, the package name of the host app is included as an extra in the intent.
String hostAppPackageName = intent.getStringExtra(Widget.Intents.EXTRA_AHA_PACKAGE_NAME);
You could store the package name for later use in your code. This is also how it is done in the utility classes of the SDK, i.e. it is stored as a global variable in the abstract class ExtensionService, which is used by all Sample extensions in the SDK.
Take a look at the SDK utility classes here
Related
What is the naming convention for android apps?
I just kicked off my 1st cordova app and out of the box it is named com.example.hello..
If my app is called "guitars" can the id not just be that?
From: Android - Package Name convention
I understand the company name coming 1st.. but i don't follow why com is preceding it
Android apps have always been named like this. It comes from Java naming. If you have an app named "guitars" it would show as com.john.guitars
Com = commercial application (just like .com, most people register their app as a com app)
First level = always the publishing entity's' name
Second level (optional) = sub-devison, group, or project name
Final level = product name
In Android, in order to get a unique identifier you need to put something that is unique to your app, and here comes your domain into place since there is only one domain with the same name, like email for example.
This will help the device recognize your app. The reason for com at the beggining is because its an old convinient from java, it helps group apps in the same place. You can of course still do org.my.domain and it will work the same but will be in a different "folder" on the device.
So the naming convention is just your domain upside down + the name of the app, There for, guitars will be in the end if the name of the app is Guitars.
The appId can be any string. So you can set it to whatever you want, including just "guitars". However, the appId must be unique on a device. If another app that is already installed has the appId as "guitars" then your app will not install. To help avoid this, Google recommends that you use a "reverse domain name". For companies that already own a domain this can help avoid name collisions since com.google is "owned" by Google and com.samsung is clearly from Samsung.
This practice comes from using reverse domain names for Java packages. See What is the significance of the reverse domain name for java package structure for an explanation.
I want to create a new app by modifying code of an existing app's source code. So I did the following from eclipse:
exported the code of the old app "app1" to a file system.
created a new Java project "app2", and imported the code that was exported earlier.
modified strings.xml, and renamed the app_name as "app2"
made other edits to app2's code, for a new feature.
ran app2 on the mobile device (connected to the PC)
Now app2 is working correctly, and its name is also seen as "app2". But I see that when I loaded the code onto the mobile device, it has replaced the app1 that was previously installed, ie the app1 is no more visible on the device.
So my question is: what other changes do I need to make (apart from the strings.xml:app_name) to make a completely new app? ie, I want both app1 and app2 to exist on the device.
You have to change package name as package name plays as unique in android.
Here is showing way how to do that :
https://stackoverflow.com/a/4025422/4161269
I'm trying to create my own version of Gesture Builder. In eclipse I selected android project from existing code and I renamed the project and package name to new gesture. Then I added in android:fadeOffset = "1000" in create gesture xml(so that I can create gestures for letters like t and f) and in AndroidManifest.xml I set the version name to NewGestures and I set a different icon but when I try to run it I get this error message:
"Re-installation failed due to different application signatures. You must perform a full uninstall of the application. WARNING: This will remove the application data! Do you want to uninstall?"
From what I've seen online I need to match the signature used originally on Gesture Builder, but I've no idea how to do this on eclipse, shouldn't the signature have been handled properly when I created from existing code? Any help would be very much appreciated. I just need this app working so I can get a gestures library for a different application I'm working on for college.
This message concerns the application signature. This happens when you are trying to install an application on your device while an application of the same package name is already installed, but signed with a different certificate (see details here).
For example:
You have exported and installed your application using your Google Play keystore (so using your actual developer's certificate), and now you are running/debugging it from Eclipse, implicitely using the debug certificate (which is different)
You have runned/debugged your application from Eclipse at home on this device, and now your are running it/debugging it from Eclipse with another computer (which is using a different implicit debug certificate)
etc
Normally, below the error message, you have a button that allows uninstalling/reinstalling. If not, just uninstall your app manually and everything will be fine again.
versionName:
The version number shown to users. This attribute can be set as a raw
string or as a reference to a string resource. The string has no other
purpose than to be displayed to users.
package:
The package name serves as a unique identifier for the application.
The package name declared in your manifest.xml is what makes your application unique. Therefore, there can not be two application installed with the same package name at the same time. If you try this, your error occurs.
I have an Android app and its package name is com.domain.myapp. During the development, I have to change it to something else due to some reasons and I changed it to com.domain.myappandroid.
Now, I have to integrate Facebook SDK for Android and it asks me to add the package name and the class name of my Activity. My Activity is named GameActivity and it is in com.domain.myapp.activities, the package name didn't change to com.domain.myappandroid.activities after changing my app package name.
I know that the package name is com.domain.myappandroid but I am not sure if I should use com.domain.myapp.activities.GameActivity or com.domain.myappandroid.activities.GameActivity. I tried both and I don't know if it is working or not since the dashboard says 0 installs for Android.
Please help, thanks!
Note:
I am using using Facebook Android SDK v3.0.2 and I can't verify if it is reporting the app installs properly.
Write the package name of your app i.e. com.domain.appandroid. It will work fine.
actually you should use com.domain.myapp, the class name have nothing to do with the Facebook SDK function but callback to game site , it means wether classname you used, the Facebook function will worked well, but if you use the com.domain.myappandroid, players click the message that send by their friends, the game will not launched。。。。 so ~ use com.domain.myapp~ i just have the same case~ and i worked very well by this way!
Good day. I'm working on an android program which is application manager. I want to call the application of "Dictionary.com" but in my code, I should include the package and activity name of this application. Can someone post here the Package name and Activity name of this Application? Please. THANK YOU!!!
Application name is something that visible to the user. So put some user friendly name such as "Digital PocketDictionary"
Package name should be unique. It is recommended if you can use your domain in reverse version. As an example, if you have your own hosting or a website related to this app such as www.digitaldic.com you can use com.digital.dictionary as the package name. Make sure all the letters are simple.
It's a little difficult to get what you are asking for, specially the activity name. But here's what you could do to get the package name.
Install the required apps on your phone and then connect it to your computer and in your Eclipse, go to the "DDMS" perspective. In the devices window, click on your phone's entry. On the right, go to the File Explorer.
Go to system/app. You should see the name of the .apk file. You'll get the name of the package in the "info" column.
Getting the name of the activity might be difficult. you could contact Dictionary.com to get the info, coz I doubt you will be able to start the activity, if Dictionary.com doesn't allow it.
I just tried this code and it works without having to include the activity's name:
PackageManager pm = this.getPackageManager();
Intent i = pm.getLaunchIntentForPackage("com.example.test3");
if (!i.equals(null)){
startActivity(i);
}else{
System.out.println("too bad (-*-)");
}