How to get Recent Photo? [closed] - flutter

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Currently i and doing on an Flutter Camera Project. May i know how can i get the recently photo to show on the container like Instagram stories left bottom?

var result = await PhotoManager.requestPermission();
if (result) {
// success
List<AssetPathEntity> list = await PhotoManager.getAssetPathList(type: RequestType.image);
final assetList = await list[0].getAssetListRange(start: 0, end: 1);
filename = await assetList[0].file;
setState(() {
});
} else {
// fail
/// if result is fail, you can call `PhotoManager.openSetting();` to open android/ios applicaton's setting to get permission
}
This works for me for getting the most recent image from the device as a thumbnail according to the plugin used from the website given by you.

Related

Flutter : Voice command to give user weather and date time update [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I want to create an application that work on voice command. In this application there is two options when user ask for weather or time update the application get the current weather and give update about weather in voice and the same functionality for time and date. Please help me how I can achieve this in flutter.
You can either use :
https://alan.app/docs/tutorials/flutter/integrating-flutter
or use:
https://pub.dev/packages/speech_to_text
import 'package:speech_to_text/speech_to_text.dart' as stt;
stt.SpeechToText speech = stt.SpeechToText();
bool available = await speech.initialize( onStatus: statusListener, onError: errorListener );
if ( available ) {
speech.listen( onResult: resultListener );
}
else {
print("The user has denied the use of speech recognition.");
}
// some time later...
speech.stop()
Then treat specific words as commands:
void resultListener(SpeechRecognitionResult result) {
++resultListened;
print('Result listener $resultListened');
setState(() {
lastWords = '${result.recognizedWords} - ${result.finalResult}';
});
}

Sending mail by button [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I want to send e-mail after confirmation box. I make a button and push after i should choice yes or no. If NO nothing do. If yes i want to start to SendAnEmail.
Please help me. How can I start the function SendAnEmail?
Thank you.
function SendAnEmail() {
var email = 'my#mail.com'
var subject = 'mySubject';
var body = 'body of mail';
GmailApp.sendEmail(email, subject, body);
}
function test(){
var ui = SpreadsheetApp.getUi();
var ret = ui.alert('Do you want send e-mail?', ui.ButtonSet.YES_NO);
if(ret == ui.Button.YES)
{GmailApp.sendEmail}
}
Thank you
You are almost there
The only thing you need to do is to call function SendAnEmail() when the button Yes is pressed.
So:
function test(){
var ui = SpreadsheetApp.getUi();
var ret = ui.alert('Do you want send e-mail?', ui.ButtonSet.YES_NO);
if(ret == ui.Button.YES){
SendAnEmail()
}
}

Ionic testing - asynchronous look for a change in ionViewDidLoad [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I have troubles trying to test the value of a variable that change inside the ionViewDidLoad method
welcomepage.ts
#Component({...})
export class WelcomePage {
test: number = 0;
constructor(){}
ionViewDidLoad(){
this.test = 1;
}
}
welcomepage.spec.ts
it('test should equal be equal to 1', () => {
fixture.detectChanges();
expect(component.test).toBe(1)
});
But this test is not succeeding. If I do the change inside the constructor function (this.test = 1) then it is working.
======== UPDATE ========
It seems that it is a problem with ionViewDidLoad function triggered by ionic, it is working as usual by running ionic but not in the test.
It appears that ionic life-cycle events (ionViewDidEnter, ionViewDidLoad, ...) are not called during testing, by calling it manually it works :
it('test should equal be equal to 1', () => {
component.ionViewDidLoad();
fixture.detectChanges();
expect(component.test).toBe(1)
});
But then how are we sure that ionic really call ionViewDidLoad ?
Your variable is not setting because you have done it in wrong way. Your variable name is test and you are setting value in variable type which is number. Please see the following snippet, hope it helps.
#Component({...})
export class WelcomePage {
test: number = 0;
constructor(){}
ionViewDidLoad(){
this.test = 1;
}
}

How to hide google adsence advert in a page for certain countries? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am a blogger and place google ads in my blog. I do not want to these ads to show up in certain countries is there any additional code I can use in my page that can help me achieve this.
For an example i do not want advert to show in Germany. Any Advise?
You can use API from http://www.geoplugin.net/
Eg. in PHP
$xml = simplexml_load_file("http://www.geoplugin.net/xml.gp?ip=".getRealIpAddr());
$country = $xml->geoplugin_countryName ;
if($country != "Germany")
{?>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Horizontal Big Banner -->
<ins class="adsbygoogle"
style="display:inline-block;width:970px;height:250px"
data-ad-client="ca-pub-XXXXXXXXXXX"
data-ad-slot="XXXXXXXX"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<?php
}
//For getting IP Address
function getRealIpAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}

button click counter blackberry cascades [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I'm trying to make an app that count how many times you've clicked the button in blackberry 10
so i'm trying to int a value that will increase by 1 when you click the button
import bb.cascades 1.2
Page {
Container {
ImageButton {
defaultImageSource: "asset:///item_XS_6405840_3762396.jpg"
onClicked: {
count.setText(count + 1)
}
onTouch: {
count.setText(count + 1)
}
}
Label {
text: "you've clicked:"
}
Label {
id: count
text: 0
}
Button {
id: reset
text: "reset"
onClicked: {
count = 0;
}
}
}
}
I only have knowledge in java. thanks for helping