I'm using Marmalade SDK and I want to create an app widget. I wrote this in pure Android and now I have a problem: how to attach it to my Marmalade project? I have access to AndroidManifest.xml and there I must add a receiver section but I don't now how to attach my classes and resources to Marmalade.
Edit:
Thanks for your answer Max.
I added
android-manifest=AndroidManifest.xml
android-external-res=android-external-res
android-external-jars="libs/Widget.jar"
to my .mkb file
and this
<receiver android:name="WidgetProvider" android:label="#string/widget1name">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="#xml/widget_info" />
</receiver>
to my AndroidManifest.xml
Now, when I start my application I haven't errors but my widget is not show on widget list.
Any ideas? Should I also use this?
android-custom-activity
android-extra-application-manifest
And how should I use it?
Edit:
Ok, I found it, section receiver sholudn't be in activity but in application. But next problem is a file R.java from my widget. Marmalade application doesn't see it. Where I have to put it? When I start my widget I get exception:
android.widget.RemoteViews$ActionException: can't find view: 0x...
You need configuration options:
android-external-jars
android-external-res
android-custom-activity
android-manifest
android-extra-application-manifest
http://developer.roolez.com/marmaladesdk/deploy/deploymenttoolsettings/configurationsettings/androidconfigurationsettings.html
Related
I come up with a strange problem while trying to set "SignUpActivity" as my starter activity. I tried different ways but either I am getting an error or "mainActivity" is popping up as a starter activity.
My "AndroidManifest.xml" file has the following code.
<activity
android:name=".SignUpActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity" />
the above code gives me the error as shown in image
As the error states activity must be exported or contain an intent-filter
so, I did
<activity
android:name=".MainActivity"
android:exported="true"/>
and also tried adding intent-filter to activity. Of course, these methods make error go away but my app starts with MainActivity, not with SignUpActivity. What should I do to slove this issue?
Your AndroidManifest.xml is set correctly, check your run/debug configuration is set to 'App', not 'MainActvity'
If the 'App' configuration is missing - you will need to add it by first selecting 'Edit Confurations'
There are similar posts about this error msg.
Check the run configuration , probably you need to edit the app configuration and choose it to run.
As guided by #Eric I selected an option "app" from the run configuration which solved my problem. Previously, somehow it was set to MainActivity which was causing the issue. I have attached an image to demonstrate the solution for future readers.
I have developed one android keyboard. It's working properly as
separate app on any device. Now I need to show my app in:
(Setting->Input)
Below image shows external keyboard added in device:
As you see in image Android keyboard is default.
Example: Swiftkey 3 is added externally.
But I don't know how to add my own keyboard so I can choose this?
You should first take a look here. Then continue with this thread here, as stated there:
Some tips:
Read this tutorial: Creating an Input Method
clone this repo: LatinIME
An inputMethod is basically an Android Service, so yes, you can do HTTP and all the stuff you can do in a Service.
You can open Activities and dialogs from the InputMethod. Once again, it's just a Service.
Here's another tutorial on the topic. I hope all this is helpful for you.
Cheers
You have to create InputMethodService... and just add below code in Menifest.xml file
<service android:name="FastInputIME"
android:label="#string/fast_input_label"
android:permission="android.permission.BIND_INPUT_METHOD">
<intent-filter>
<action android:name="android.view.InputMethod" />
</intent-filter>
<meta-data android:name="android.view.im" android:resource="#xml/method" />
</service>
Permisson:
<uses-permission android:name="android.permission.BIND_INPUT_METHOD"/>
I'm upgrading my app with widget. It's not the first widget I've done. I was always encountering weird issues, but the widget was shwoing up on the list eventually.
Here is what I've done so far:
Created widget_layout.xml
Created widget_info.xml
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="110dp"
android:minHeight="30dp"
android:updatePeriodMillis="86400000"
android:initialLayout="#layout/widget_layout"
android:resizeMode="none">
</appwidget-provider>
Created WidgetProvider class
Added widget to manifest in the <application> section (for some reason can't paste manifest fragment here, it's just not showing, see the code here)
Still, can't find widget on the widgets list. I'm debugging the app on real device. I'm using library project, but the widget files but all in the project I run directly. What could be happening here?
Ran across similar issues and this is what happened for me. The below Widget never showed up in the Widget drawer till minResizeHeight was added. Weird, but may be that is required for resizable widget. Could have been more friendly.
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:initialLayout="#layout/pmt_schedule_scroll_widget"
android:minHeight="146dip"
android:minResizeHeight="73dp"
android:minWidth="146dip"
android:resizeMode="vertical"
android:updatePeriodMillis="0" />
This kind of issue can happen with 2 scenarios. Both are answered above and this is a complete answer and I have faced both the scenarios and resolved both of them.
Scenario1
If the application specifies android:installLocation="preferExternal" parameter in manifest, App will be installed in external memory and it will not show in the widget list. Also if you have made your phone to install all the apps on sd card, this will also happen.
solution
Go to Settings->Apps->YourApp
Then "move to phone". This will move the app to your phone memory and now you can see the widget in your widget list
Scenario2
If the above fix did not solve your issue, then you may have a device with android 4.X.X version.
Then you have to set at least following parameters in widget_info.xml file
solution2
android:minHeight="XXXdp"
android:minWidth="XXXdp"
The problem was android:installLocation="preferExternal"
It somehow causes problem with widget list if the app is installed on SD
I tried every possible solution and nothing worked for me...
And finally I solved it.
In my case the problem was overthinking: I believed that in meta-data tag we need to define a unique name for provider (eg: "com.example.myprovider") as well as link to the xml resource.
Wrong:
<meta-data
android:name="com.example.myprovider"
android:resource="#xml/widget_info" />
Right:
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/widget_info" />
You need to register a BroadcastReceiver in the manifest file. For example:
<receiver
android:icon="#drawable/icon"
android:label="Example Widget"
android:name="MyWidgetProvider" >
<intent-filter >
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/widget_info" />
</receiver>
I borrowed this code from http://www.vogella.com/articles/AndroidWidgets/article.html
See the link for a full tutorial
after hours of searching and failing to resolve, I decided to open a sample project of a widget that works and go comparing item by item to see what was wrong, in the end, I solve added the following lines on my res/xml/widget_info.xml:
android:minHeight="XXXdp"
android:minResizeHeight="XXXdp"
android:minResizeWidth="XXXdp"
android:minWidth="XXXdp"
where XXX is some value.
In my case, the issue was in the intent-filter within the receiver.
Wrong:
<intent-filter>
<action android:name="APPWIDGET_UPDATE" />
</intent-filter>
Correct:
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
In my case, it was the minWidth, it was too large, just put a smaller dp, it works also with a minHeight too height as well!
I'm going through the Android 'Building Your First App' tutorial and have gotten stuck trying to run the app. I created the app and emulator with Eclipse (Juno Build id: 20120920-0800 on OS X, default installation. The Android SDK, etc. was updated today).
The app appears to be installed on the emulator. I.e. 'Home -> Menu -> Manage Apps' lists it and it's App info looks ok. (Total=24.00KB, App=24.00KB, USN storage app=0.00B, ...).
However, it does not appear in the apps launch list (i.e. the screen with 'API Demos', 'Browser', etc.
Is there some other way to launch it? Is there something I have to do to get it into the app list? Any help would be appreciated - this is driving me crazy.
thanks
In your manifest xml file you need to make sure that you have
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
in your activity definition. If you don't see your application in the launcher then it suggests you don't have "android.intent.category.LAUNCHER" set.
Your manifest file should have something like (this isn't a complete manifest)
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".MyActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
You can't just put the intent-filter lines in your manifest. If you double click the manifest it will open up. You get 2 methods to edit it, raw XML or using a basic interface. Personally I think you're better off with the raw interface. Look below the window that opens when you double click the manifest, you'll see some tabs like Manifest, Application... the last on is AndroidManifest.xml - this is the raw xml. The first one is basic setup.
Don't forget to save your manifest file and do a clean and build then run it.
Good evening.
I've seen that there are people with questions similar to this but I suppose mine is a little different since I haven't found a solution yet.
I've developed a basic widget that displays the battery percentage, and today, two people told me that they can't add my widget to their home screen because it doesn't appear neither in the widget list, neither in the installed applications list. They had to uninstall it from the Android Market.
I'm not sure if this is a bug on their AppWidgetPicker.apk or a bug in my Manifest since my widgets works in most devices. Feel free to search for "henrique rocha" in the Market and install my "Battery Widget" to see if you have the same problem.
In Eclipse I'm getting the following errors:
No Launcher activity found!
The launch will only sync the application package on the device!
I don't know if that might be the problem that causes the widget to not get listed in the widgets list.
Since I don't have an activity, neither a configuration activity and adding both action.MAIN and category.LAUNCHER to my intent-filter tag inside my receiver tag didn't solve the problem, I'm asking for your help.
Here is my full of Manifest if it helps.
<uses-sdk android:minSdkVersion="3" />
<application android:icon="#drawable/battery" android:label="#string/app_name">
<receiver android:name="BatteryAppWidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="#xml/appwidget_info" />
</receiver>
<!-- Service to maintain widget alive -->
<service android:name="BatteryService" />
</application>
And here is my appwidget_info.xml:
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="72dip"
android:minHeight="72dip"
android:updatePeriodMillis="0"
android:initialLayout="#layout/main"
>
</appwidget-provider>
Well, you're right that since it is a widget you can't launch it from Eclipse: there is no Activity with the Launcher intent filter.
Include your entire Manifest so we can be sure you aren't leaving anything else out The AppWidget provider list should include any receivers that handle the AppWidgetManager.ACTION_APPWIDGET_UPDATE Intent, which yours does, BUT also has the AppWidgetProviderInfo XML metadata. If you have that it should work reliably on every handset that isn't somehow borked. I'd check if the folks reporting that it doesn't work are using alternative widget pickers.