Display one time welcome screen titanium - titanium

I am working on titanium [new to this platform], I am using Titanium 3.1.0 version Alloy.
display one time welcome screen.
welcome screen name is IndexWindow next screen is LoginWindow.
when i relaunch the application it need to show loginWindow. not IndexWindow[welcome Screen].
Where i need to do changes for this?
# all
Thanks in advance

To solve this you'll need to persist the info by using properties like this :
if(Ti.App.Properties.hasProperty('loggedBefore')) {
// open login window
} else {
Ti.App.Properties.setString('loggedBefore', '1');
// open indexWindow
}

Related

Jetpack Compose: Best way to display a start screen only the first time you start the app

I am currently working on an app that has a start screen where I want to input a unique code to add a device through firebase. After adding the first device the menu screen should appear after starting the app.
I currently do that with two Activities and a Shared Preference that checks if I have at least one device and redirects me from the StartActivity to the MenuActivity.
Although that works fine, I don't think it is a good solution. Is there any other way to have a Start Screen that only appears until you entered the first unique code using Jetpack Compose?
Edit:
I found this awesome YouTube video, that explains this answer even better: https://www.youtube.com/watch?v=6dRwaXH2cYA
I know this question is old, but I want to help others finding this while looking for an answer.
The basic Idea would be to have a boolean preference saved in a datastore, that show whether the app has already been opened. The default value would be false, and on every app launch, this preference is checked. If its value is false, you show the screen and then set it to true. When you then relaunch the app, the preference has the value "true" and you don't show the screen. You could archive this, by having an if-statment in the constructor of the Navhost, that controls the "startDestination" value. Something like this:
NavHost(
navController = navController,
startDestination =
if(uiState.isFirstLaunch) {
//set your first launch screen
} else {
//default screen
}
){ ...

How to open app from Recently open apps in android device using Appium?

I have tried the following code for the above mentioned problem,
driver.pressKey(new KeyEvent().withKey(AndroidKey.APP_SWITCH));
//Code for swipe left
((AndroidDriver) driver).startActivity(new Activity(ANDROID_PACKAGE, ANDROID_STARTACTIVITY));
//user you application package name and activity for start application
When I switch between applications my previous application gets restart. Could anyone please help me to stop this restart.
Key presses on appium are done by
driver.press_keycode(code)
All required codes can be found here
187 - KEYCODE_APP_SWITCH
So in your case,
The final code would be like,
driver.press_keycode(187) - KEYCODE_APP_SWITCH

how to navigate to settings in android emulator using robotium?

I am a newbie for Robotium and till then I managed to learn a lot by directly writing test cases for public websites and sorted out several issues from answers in stackoverflow. now, I seemed to hit the wall at this (probably)trivial problem.
I would like to navigate to 'Settings' icon which is inside 'Apps' menu of the android emulator using some sort of 'robotium-solo' method.
This is my failed attempt:
solo.sendKey(KeyEvent.KEYCODE_HOME);
//solo.clickOnImageButton(2); // no success!
//solo.clickOnActionBarItem(2); // no success!
solo.clickOnText("Settings");
solo.clickOnText("Music");
I checked for any KEYCODE_var for home screen 'app' icon but couldn't find one.
There is no useful log message in DDMS to figure out the starting activity when clicked/tapped on that button.s
Please guide me whether my approach is any good and help me with an answer. Thanks.
you can check with getCurrentViews() and have the list of views displayed before clicking the menu button and after clicking the menu button.By comparing them you can get the view of the new views displayed (i.e. settings button).
After getting the view,you can go with solo.clickOnView(ViewNameObtained);
This will solve your problem for sure.
As far as I know, navigating to settings is not possible with robotium. Even if you would be able to go there you cannot perform any other action as Settings are not port of your application. Android Instrumentation allows performing actions only within one package and robotium is only wrapper for that, so it's not able to click outside your application as well.
You can use UI Automator for that.

equivalent to android's share intent concept for iPhone using titanium?

I want to add share content functionality in my iOS app. I am developing an app in titanium for iPhone. I want to add a share button that when a user clicks will open a dialog box contains many different option like Facebook, twitter, email , and print.
Unless this has been included in the Appcelerator Framework, you are going to have to write a module
"Share Screen" iOS 6
There is a module for this that wraps the Social.framework on iOS. Ive used it in my own apps and its quite nice. Find it here.
And a small example of how to make it work.
var Social = require('com.0x82.social');
Social.showActivityItems({
activityItems : ["http://stackoverflow.com"]
});
Social.addEventListener('activityWindowClosed', function(e) {
if (e.completed) {
alert('Shared successfully');
}
});

when start App, than how to remove this Titanium default Page or picture?

I am new Application Developer with the Titanium. i want to develop new Application with Titanium and created a HelloWorld application. Every time my application starts up Than every time Titanium startscreen is show. how I remove this Titanium Startscreen.
I have also 1 question when i run the application in iPhone than show its title bar with windows.
but, in android have not show.
i use build custom with use if else statement i add the title bar. but, any syntax. whose add the tittle bar in android.
I have also occur this type problem than, i sort out this problem with the help of my friend.
I write below step by step.
go to the resource folder where u create ur application.
select the build folder and open iphone and copy the picture whose u want to show on screen.
and rename with default.png
I, think this is useful to you. Let try it.