How to debug widget applications in Xamarin studio? - android

I'm experimenting with Simple widget application in Xamarin studio and would like to know how to debug it. Trying regular 'Run -> Start Debugging' (F5) produces
Application does not contain a launchable activity
As far as I understand ActivityAttribute.MainLauncher property is designed specifically for this purpose but there is no activity to apply it to in the example I'm playing with.
p.s.
Is there something similar to 'Attach to process' feature?

It seems that there is still no simple solution other than embedding your widget into a self created activity just for the debugging purposes. The last post from the Xamarin team I've found is here.
I've tried a few approaches with an empty activity and trying to trick the debugger - but failed.

Related

Make android launcher default launcher in Kotlin

I'm programming an android launcher for kids. I want my launcher to be the default launcher automatically when I start my app. And when I exit my app, the old launcher is set as the default launcher again.
I read that this has not been possible for some time because of safety reason. But in the Samsung Kids Launcher it is possible.
I have found some work arounds - like opening the settings or open the launcher-chooser.
I don't like these solutions because it's very inconvenient and the settings are difficult for some people.
I found code but the code was very old and doesn't seem to work anymore.
I found a function that allows me to query whether my app is set as the default.
And I found two function for going in the settings.
ACTION_APPLICATION_DETAILS_SETTINGS
ACTION_MANAGE_DEFAULT_APPS_SETTINGS
But these settings are not the right one (very unspecified)
I found this articel:
how-to-set-default-launcher-from-setting-programatically
But I haven't used it to run yet.
Can you help me?
ps: I am a beginner in Kotlin and Android programming

How to start developing app for Google Glass?

I am working on a Google glass Android app. I have installed the glass development kit (GDK) in Android SDK. Now I created a glass project using Android Studio (Version 3.3.2). The newly created project is showing an error "Default Activity not found" in run->edit configuration.
Please refer the screenshot for the error.
1.
And 2. By clicking run->Edit Configuration in menu.
I have searched a lot on Google and found many articles regarding the same. All are suggested to set the edit configurations option like below.
Module: app
Package: Deploy default APK
Activity: Launch default Activity
Target Device: USB Device
I did the same, but no one is working for me. After spending the whole day to make it work, I came here. This error is due to the Launcher activity, because there is no launcher activity in Google glass project instead it uses Voice Trigger intent filter. It is similar to wearable apps they also don't have the launcher activity.
Android Studio won't let you use a standard run configuration without specifying a launcher in the manifest.
You could try using the gradle command line instead:
./gradlew installDebug
In case you haven't resolved the issue. I came across similar issue before, two ways worked for me:
Choose "Nothing" as the option. You will be able to run the app manually on the Glass, but your debugger won't work straight away. You have to manually attach the debugger to the process. You may also have to use logcat if there is a bug in the launching process.
Specify an activity (whichever is associated with voice trigger).
Also, I noticed that you created the app using Kotlin. Kotlin activity didn't work in my case, throwing exceptions associated with nullable var when resuming the activity. Non-activity classes worked fine. Please let me know if Kotlin activity worked in your case.

Custom Keyboard - Could not identify launch activity: Default Activity not found

I am following a tutorial on creating a custom keyboard for an Android device. I am using Android Studio 2.1.2. There is no activity in the program because you have to activate the keyboard in the language & input settings.
When I run the program I get this error: "Could not identify launch activity: Default Activity not found
Error while Launching activity"
I have posted on the site but have gotten no response. I followed the tutorial step by step and looked it over for a couple of days. I am new to Android Studio and Android applications and was wondering if anyone knew how to help me.
This is the link to the site I am following: http://code.tutsplus.com/tutorials/create-a-custom-keyboard-on-android--cms-22615
I just figured out what needed to be done.
You have to edit the configurations and change the launch option to "nothing". This way it won't try to launch and activity that does not exist.
run->edit configurations then look for the launch options
Well you have answered it by yourself.
If you are creating an keyboard application(inputmethod) in android, everytime you compile and run your applcation, it will show a warning that there is no default activity since it's InputMethodService, the service. Even you add activity like some settings activity for your keyboard, it will still show you warnings and it's the normal operation.

Android lock widget available?

I'd like to add a lock widget to my application but I am unable to find one.
The android 4.4 alarm clock for example has one. Or the android lock screen. Are there similar components available as widgets which can be dragged into a layout in eclipse?
The widget is called GlowPad and is part of the Android 4.4.4 AlarmClock.
I ended up using net.frakbot.glowpadbackport.GlowPadView.java, which is available at github.
I've ignored the readme.md, the gradlew (which is some kind of non-working makefile) and all the crap that came with it[1]. Instead I've created an android project from scratch with scr.frakbot/*, an empty AndroidManifest , values/attrs.xml and lib/nineoldandroids-2.4.0.jar and it. And it worked out of the box.
[1] Don't get me wrong, gradle is a nice software, but why should I care creating a gradle.local, a keystore from keystore.example (!) and all that, if I can simply drop the 9 necessary files into eclipse?

how to figure out the flow of an android project using debug

I'm new to android development.
I download a toy project and want to figure out the flow of this project.
Can I use debugging to figure out it and how?
Let me explain it more detail. Every android project starts from an "main" activity. I guess I find the "main" activity for the project and set a breakpoint at the onCreate method of this "main" activity. I expect to run this project from that breakpoint one step by step to figure out the flow. However it doesn't work since the debugging stop after finishing the onCreate method.
Start with AndroidManifest.xml file. Open it and look for an Activity with LAUNCHER category. Then open that Activity and go to onCreate(...) method. This is where your app starts. Inside the method, there is a call to setContentView(R.layout.some_layout). some_layout.xml in res/layout folder is UI for this Activity.
Each window you see in Android app is an Activity and each Activity has a layout file.
The "flow" of an android application is more like an asynchronous model than a sequential flow of action. There is a main application loop that processes external events (such as clicks on button) and callbacks related to the activity lifecycle (such as your onCreate method), and lot of other stuff.
Every event is put into the queue and processed asynchronously, so it's not easy to follow it. It's better to think about actions and reactions. In any case you can dig into the android source code and see what's running behind the scenes. Some hints about the model of android apps can be found here but any google search for "android ui thread queue" would lead to relevant info.
If you want to learn the flow of a typical android application, I would recommend you download the samples if you haven't already and add your own log statements. You could use the debugger too. Then start making small changes here and there to force different 'flows' of control, as you make guesses about what should happen and observe your logging statements and the app behavior to see what's going on.
The sample projects can be downloaded from the adt plugin in eclipse and come as ready-made projects. They are also a good way to learn because they are generally the 'best-practice' way of doing things.
Hope that helps! Good luck :)

Categories

Resources